| | | 1 | | // Copyright (c) 2020-2023 dotBunny Inc. |
| | | 2 | | // dotBunny licenses this file to you under the BSL-1.0 license. |
| | | 3 | | // See the LICENSE file in the project root for more information. |
| | | 4 | | |
| | | 5 | | using System; |
| | | 6 | | using GDX.Collections; |
| | | 7 | | using UnityEngine; |
| | | 8 | | using Object = UnityEngine.Object; |
| | | 9 | | |
| | | 10 | | namespace GDX.Tables |
| | | 11 | | { |
| | | 12 | | [CreateAssetMenu(menuName = "GDX/Stable Table", fileName = "GDXStableTable")] |
| | | 13 | | [Serializable] |
| | | 14 | | public class StableTable : TableBase |
| | | 15 | | { |
| | 0 | 16 | | internal static string UnityObjectString = typeof(Object).AssemblyQualifiedName; |
| | | 17 | | |
| | 0 | 18 | | [SerializeField] internal string DisplayName = "GDXStableTable"; |
| | | 19 | | |
| | | 20 | | [SerializeField] internal ArrayHolder<string>[] AllStringColumns; |
| | | 21 | | [SerializeField] internal ArrayHolder<bool>[] AllBoolColumns; |
| | | 22 | | [SerializeField] internal ArrayHolder<char>[] AllCharColumns; |
| | | 23 | | [SerializeField] internal ArrayHolder<sbyte>[] AllSbyteColumns; |
| | | 24 | | [SerializeField] internal ArrayHolder<byte>[] AllByteColumns; |
| | | 25 | | [SerializeField] internal ArrayHolder<short>[] AllShortColumns; |
| | | 26 | | [SerializeField] internal ArrayHolder<ushort>[] AllUshortColumns; |
| | | 27 | | [SerializeField] internal ArrayHolder<int>[] AllIntColumns; |
| | | 28 | | [SerializeField] internal ArrayHolder<uint>[] AllUintColumns; |
| | | 29 | | [SerializeField] internal ArrayHolder<long>[] AllLongColumns; |
| | | 30 | | [SerializeField] internal ArrayHolder<ulong>[] AllUlongColumns; |
| | | 31 | | [SerializeField] internal ArrayHolder<float>[] AllFloatColumns; |
| | | 32 | | [SerializeField] internal ArrayHolder<double>[] AllDoubleColumns; |
| | | 33 | | [SerializeField] internal ArrayHolder<Vector2>[] AllVector2Columns; |
| | | 34 | | [SerializeField] internal ArrayHolder<Vector3>[] AllVector3Columns; |
| | | 35 | | [SerializeField] internal ArrayHolder<Vector4>[] AllVector4Columns; |
| | | 36 | | [SerializeField] internal ArrayHolder<Vector2Int>[] AllVector2IntColumns; |
| | | 37 | | [SerializeField] internal ArrayHolder<Vector3Int>[] AllVector3IntColumns; |
| | | 38 | | [SerializeField] internal ArrayHolder<Quaternion>[] AllQuaternionColumns; |
| | | 39 | | [SerializeField] internal ArrayHolder<Rect>[] AllRectColumns; |
| | | 40 | | [SerializeField] internal ArrayHolder<RectInt>[] AllRectIntColumns; |
| | | 41 | | [SerializeField] internal ArrayHolder<Color>[] AllColorColumns; |
| | | 42 | | [SerializeField] internal ArrayHolder<LayerMask>[] AllLayerMaskColumns; |
| | | 43 | | [SerializeField] internal ArrayHolder<Bounds>[] AllBoundsColumns; |
| | | 44 | | [SerializeField] internal ArrayHolder<BoundsInt>[] AllBoundsIntColumns; |
| | | 45 | | [SerializeField] internal ArrayHolder<Hash128>[] AllHash128Columns; |
| | | 46 | | [SerializeField] internal ArrayHolder<Gradient>[] AllGradientColumns; |
| | | 47 | | [SerializeField] internal ArrayHolder<AnimationCurve>[] AllAnimationCurveColumns; |
| | | 48 | | [SerializeField] internal ArrayHolder<Object>[] AllObjectRefColumns; |
| | | 49 | | [SerializeField] internal string[] AllObjectRefTypeNames; |
| | | 50 | | |
| | 0 | 51 | | [SerializeField] internal ArrayHolder<string>[] |
| | | 52 | | AllColumnNames = |
| | | 53 | | new ArrayHolder<string>[Serializable |
| | | 54 | | .SerializableTypesCount]; // Contains the name of each column of each type. Ordered by Serializable. |
| | | 55 | | |
| | | 56 | | [SerializeField] internal int[] RowIDToDenseIndexMap; |
| | | 57 | | [SerializeField] internal int[] RowDenseIndexToIDMap; |
| | | 58 | | [SerializeField] internal string[] RowNames; |
| | | 59 | | [SerializeField] internal int RowEntriesFreeListHead; |
| | | 60 | | |
| | | 61 | | [SerializeField] internal int RowCount; |
| | | 62 | | |
| | | 63 | | [SerializeField] internal ColumnEntry[] ColumnIDToDenseIndexMap; |
| | | 64 | | [SerializeField] internal int[] ColumnIDToSortOrderMap; |
| | | 65 | | [SerializeField] internal int[] SortedOrderToColumnIDMap; |
| | | 66 | | |
| | | 67 | | // TODO move with other block |
| | | 68 | | [SerializeField] |
| | 0 | 69 | | ArrayHolder<int>[] ColumnDenseIndexToIDMap = new ArrayHolder<int>[Serializable.SerializableTypesCount]; |
| | | 70 | | |
| | | 71 | | [SerializeField] internal int ColumnEntriesFreeListHead; |
| | | 72 | | |
| | | 73 | | [SerializeField] internal int CombinedColumnCount; |
| | | 74 | | |
| | 0 | 75 | | [SerializeField] internal ulong DataVersion = 1; |
| | | 76 | | |
| | | 77 | | [SerializeField] BitArray8 SettingsFlags; |
| | | 78 | | |
| | | 79 | | /// <inheritdoc /> |
| | | 80 | | public override ulong GetDataVersion() |
| | 0 | 81 | | { |
| | 0 | 82 | | return DataVersion; |
| | 0 | 83 | | } |
| | | 84 | | |
| | | 85 | | /// <inheritdoc /> |
| | | 86 | | public override int GetColumnCount() |
| | 0 | 87 | | { |
| | 0 | 88 | | return CombinedColumnCount; |
| | 0 | 89 | | } |
| | | 90 | | |
| | | 91 | | /// <inheritdoc /> |
| | | 92 | | public override int GetRowCount() |
| | 0 | 93 | | { |
| | 0 | 94 | | return RowCount; |
| | 0 | 95 | | } |
| | | 96 | | |
| | | 97 | | /// <inheritdoc /> |
| | | 98 | | public override string GetDisplayName() |
| | 0 | 99 | | { |
| | 0 | 100 | | return DisplayName; |
| | 0 | 101 | | } |
| | | 102 | | |
| | | 103 | | /// <inheritdoc /> |
| | | 104 | | public override void SetDisplayName(string displayName) |
| | 0 | 105 | | { |
| | 0 | 106 | | DisplayName = displayName; |
| | 0 | 107 | | } |
| | | 108 | | |
| | | 109 | | /// <inheritdoc /> |
| | | 110 | | public override bool GetFlag(Flags flag) |
| | 0 | 111 | | { |
| | 0 | 112 | | return SettingsFlags[(byte)flag]; |
| | 0 | 113 | | } |
| | | 114 | | |
| | | 115 | | /// <inheritdoc /> |
| | | 116 | | public override void SetFlag(Flags flag, bool toggle) |
| | 0 | 117 | | { |
| | 0 | 118 | | SettingsFlags[(byte)flag] = toggle; |
| | 0 | 119 | | } |
| | | 120 | | |
| | | 121 | | /// <inheritdoc /> |
| | | 122 | | public override RowDescription[] GetAllRowDescriptions() |
| | 0 | 123 | | { |
| | 0 | 124 | | if (CombinedColumnCount == 0 || RowCount == 0) |
| | 0 | 125 | | { |
| | 0 | 126 | | return null; |
| | | 127 | | } |
| | | 128 | | |
| | 0 | 129 | | RowDescription[] returnArray = new RowDescription[RowCount]; |
| | 0 | 130 | | for (int i = 0; i < RowCount; i++) |
| | 0 | 131 | | { |
| | 0 | 132 | | returnArray[i].Identifier = RowDenseIndexToIDMap[i]; |
| | 0 | 133 | | returnArray[i].Name = RowNames[i]; |
| | 0 | 134 | | } |
| | | 135 | | |
| | 0 | 136 | | return returnArray; |
| | 0 | 137 | | } |
| | | 138 | | |
| | | 139 | | /// <inheritdoc /> |
| | | 140 | | public override RowDescription GetRowDescription(string name) |
| | 0 | 141 | | { |
| | 0 | 142 | | for (int i = 0; i < RowCount; i++) |
| | 0 | 143 | | { |
| | 0 | 144 | | string nameAt = RowNames[i]; |
| | | 145 | | |
| | 0 | 146 | | if (nameAt == name) |
| | 0 | 147 | | { |
| | 0 | 148 | | return new RowDescription { Identifier = RowDenseIndexToIDMap[i], Name = nameAt }; |
| | | 149 | | } |
| | 0 | 150 | | } |
| | | 151 | | |
| | 0 | 152 | | throw new ArgumentException("Row with name " + name + " does not exist in the table"); |
| | 0 | 153 | | } |
| | | 154 | | |
| | | 155 | | /// <inheritdoc /> |
| | | 156 | | public override RowDescription GetRowDescription(int order) |
| | 0 | 157 | | { |
| | 0 | 158 | | return new RowDescription { Identifier = RowDenseIndexToIDMap[order], Name = RowNames[order] }; |
| | 0 | 159 | | } |
| | | 160 | | |
| | | 161 | | /// <inheritdoc /> |
| | | 162 | | public override void SetAllRowDescriptionsOrder(RowDescription[] orderedRows) |
| | 0 | 163 | | { |
| | | 164 | | // TODO: @adam array coming in be in the new order, just use the internalIndex (stable to reorder inside her |
| | 0 | 165 | | throw new NotImplementedException(); |
| | | 166 | | } |
| | | 167 | | |
| | | 168 | | /// <inheritdoc /> |
| | | 169 | | public override ColumnDescription GetColumnDescription(string name) |
| | 0 | 170 | | { |
| | 0 | 171 | | for (int i = 0; i < Serializable.SerializableTypesCount; i++) |
| | 0 | 172 | | { |
| | 0 | 173 | | string[] columnNames = AllColumnNames[i].TArray; |
| | | 174 | | |
| | 0 | 175 | | if (columnNames != null) |
| | 0 | 176 | | { |
| | 0 | 177 | | for (int j = 0; j < columnNames.Length; j++) |
| | 0 | 178 | | { |
| | 0 | 179 | | string nameAt = columnNames[j]; |
| | | 180 | | |
| | 0 | 181 | | if (name == nameAt) |
| | 0 | 182 | | { |
| | 0 | 183 | | int columnID = ColumnDenseIndexToIDMap[i].TArray[j]; |
| | | 184 | | |
| | 0 | 185 | | ref ColumnEntry columnEntry = ref ColumnIDToDenseIndexMap[columnID]; |
| | 0 | 186 | | return new ColumnDescription |
| | | 187 | | { |
| | | 188 | | Identifier = columnID, Name = nameAt, Type = columnEntry.ColumnType |
| | | 189 | | }; |
| | | 190 | | } |
| | 0 | 191 | | } |
| | 0 | 192 | | } |
| | 0 | 193 | | } |
| | | 194 | | |
| | 0 | 195 | | throw new ArgumentException("Column with name " + name + " does not exist in the table"); |
| | 0 | 196 | | } |
| | | 197 | | |
| | | 198 | | /// <inheritdoc /> |
| | | 199 | | public override ColumnDescription GetColumnDescription(int order) |
| | 0 | 200 | | { |
| | 0 | 201 | | int idAtOrderedIndex = SortedOrderToColumnIDMap[order]; |
| | 0 | 202 | | ref ColumnEntry columnEntry = ref ColumnIDToDenseIndexMap[idAtOrderedIndex]; |
| | | 203 | | |
| | 0 | 204 | | string columnName = AllColumnNames[(int)columnEntry.ColumnType][columnEntry.ColumnDenseIndex]; |
| | | 205 | | |
| | 0 | 206 | | return new ColumnDescription |
| | | 207 | | { |
| | | 208 | | Identifier = idAtOrderedIndex, Name = columnName, Type = columnEntry.ColumnType |
| | | 209 | | }; |
| | 0 | 210 | | } |
| | | 211 | | |
| | | 212 | | /// <inheritdoc /> |
| | | 213 | | public override void SetAllColumnDescriptionsOrder(ColumnDescription[] orderedColumns) |
| | 0 | 214 | | { |
| | | 215 | | // TODO: @adam array coming in be in the new order, just use the internalIndex (stable to reorder inside her |
| | 0 | 216 | | throw new NotImplementedException(); |
| | | 217 | | } |
| | | 218 | | |
| | | 219 | | /// <inheritdoc /> |
| | | 220 | | public override ColumnDescription[] GetAllColumnDescriptions() |
| | 0 | 221 | | { |
| | 0 | 222 | | if (CombinedColumnCount == 0) |
| | 0 | 223 | | { |
| | 0 | 224 | | return null; |
| | | 225 | | } |
| | | 226 | | |
| | 0 | 227 | | ColumnDescription[] returnArray = new ColumnDescription[CombinedColumnCount]; |
| | | 228 | | |
| | 0 | 229 | | for (int i = 0; i < CombinedColumnCount; i++) |
| | 0 | 230 | | { |
| | 0 | 231 | | int columnID = SortedOrderToColumnIDMap[i]; |
| | 0 | 232 | | AssertColumnIDValid(columnID); |
| | 0 | 233 | | ref ColumnEntry entryForID = ref ColumnIDToDenseIndexMap[columnID]; |
| | 0 | 234 | | ref ArrayHolder<string> nameColumnsForType = ref AllColumnNames[(int)entryForID.ColumnType]; |
| | | 235 | | |
| | 0 | 236 | | string name = nameColumnsForType[entryForID.ColumnDenseIndex]; |
| | | 237 | | |
| | 0 | 238 | | returnArray[i] = new ColumnDescription |
| | | 239 | | { |
| | | 240 | | Name = name, Identifier = columnID, Type = entryForID.ColumnType |
| | | 241 | | }; |
| | 0 | 242 | | } |
| | | 243 | | |
| | 0 | 244 | | return returnArray; |
| | 0 | 245 | | } |
| | | 246 | | |
| | | 247 | | internal void AssertColumnIDValid(int columnID) |
| | 0 | 248 | | { |
| | 0 | 249 | | if (columnID < 0 || columnID >= ColumnIDToDenseIndexMap.Length) |
| | 0 | 250 | | { |
| | 0 | 251 | | throw new ArgumentException("Invalid column outside valid ID range: " + columnID); |
| | | 252 | | } |
| | | 253 | | |
| | 0 | 254 | | ref ColumnEntry columnEntry = ref ColumnIDToDenseIndexMap[columnID]; |
| | | 255 | | |
| | 0 | 256 | | if (columnEntry.ColumnType == Serializable.SerializableTypes.Invalid) |
| | 0 | 257 | | { |
| | 0 | 258 | | throw new ArgumentException("Invalid column pointing to deallocated entry: " + columnID); |
| | | 259 | | } |
| | 0 | 260 | | } |
| | | 261 | | |
| | | 262 | | internal void AssertRowIDValid(int rowID) |
| | 0 | 263 | | { |
| | 0 | 264 | | if (rowID < 0 || rowID >= RowIDToDenseIndexMap.Length) |
| | 0 | 265 | | { |
| | 0 | 266 | | throw new ArgumentException("Invalid row outside valid ID range: " + rowID); |
| | | 267 | | } |
| | | 268 | | |
| | 0 | 269 | | int rowIndex = RowIDToDenseIndexMap[rowID]; |
| | | 270 | | |
| | 0 | 271 | | if (rowIndex >= RowCount || rowIndex < 0) |
| | 0 | 272 | | { |
| | 0 | 273 | | throw new ArgumentException("Invalid row outside valid ID range: " + rowID); |
| | | 274 | | } |
| | 0 | 275 | | } |
| | | 276 | | |
| | | 277 | | /// <inheritdoc /> |
| | | 278 | | public override void SetColumnName(string columnName, int columnIdentifier) |
| | 0 | 279 | | { |
| | 0 | 280 | | AssertColumnIDValid(columnIdentifier); |
| | 0 | 281 | | ref ColumnEntry columnEntry = ref ColumnIDToDenseIndexMap[columnIdentifier]; |
| | 0 | 282 | | AllColumnNames[(int)columnEntry.ColumnType][columnEntry.ColumnDenseIndex] = columnName; |
| | 0 | 283 | | } |
| | | 284 | | |
| | | 285 | | /// <inheritdoc /> |
| | | 286 | | public override string GetColumnName(int columnIdentifier) |
| | 0 | 287 | | { |
| | 0 | 288 | | AssertColumnIDValid(columnIdentifier); |
| | 0 | 289 | | ref ColumnEntry columnEntry = ref ColumnIDToDenseIndexMap[columnIdentifier]; |
| | 0 | 290 | | return AllColumnNames[(int)columnEntry.ColumnType][columnEntry.ColumnDenseIndex]; |
| | 0 | 291 | | } |
| | | 292 | | |
| | | 293 | | |
| | | 294 | | /// <inheritdoc /> |
| | | 295 | | public override void SetRowName(string rowName, int rowIdentifier) |
| | 0 | 296 | | { |
| | 0 | 297 | | AssertRowIDValid(rowIdentifier); |
| | 0 | 298 | | int rowDenseIndex = RowIDToDenseIndexMap[rowIdentifier]; |
| | 0 | 299 | | RowNames[rowDenseIndex] = rowName; |
| | 0 | 300 | | } |
| | | 301 | | |
| | | 302 | | /// <inheritdoc /> |
| | | 303 | | public override string GetRowName(int rowIdentifier) |
| | 0 | 304 | | { |
| | 0 | 305 | | AssertRowIDValid(rowIdentifier); |
| | 0 | 306 | | int rowDenseIndex = RowIDToDenseIndexMap[rowIdentifier]; |
| | 0 | 307 | | return RowNames[rowDenseIndex]; |
| | 0 | 308 | | } |
| | | 309 | | |
| | | 310 | | public ref string GetRowNameRef(int row) |
| | 0 | 311 | | { |
| | 0 | 312 | | AssertRowIDValid(row); |
| | 0 | 313 | | int rowDenseIndex = RowIDToDenseIndexMap[row]; |
| | 0 | 314 | | return ref RowNames[rowDenseIndex]; |
| | 0 | 315 | | } |
| | | 316 | | |
| | | 317 | | public ref string GetColumnNameRef(int columnID) |
| | 0 | 318 | | { |
| | 0 | 319 | | AssertColumnIDValid(columnID); |
| | 0 | 320 | | ref ColumnEntry columnEntry = ref ColumnIDToDenseIndexMap[columnID]; |
| | 0 | 321 | | return ref AllColumnNames[(int)columnEntry.ColumnType][columnEntry.ColumnDenseIndex]; |
| | 0 | 322 | | } |
| | | 323 | | |
| | | 324 | | /// <inheritdoc /> |
| | | 325 | | public override int AddRow(string rowName = null, int insertAtRowID = -1) |
| | 0 | 326 | | { |
| | 0 | 327 | | if (insertAtRowID >= 0) |
| | 0 | 328 | | { |
| | 0 | 329 | | AssertRowIDValid(insertAtRowID); |
| | 0 | 330 | | } |
| | | 331 | | |
| | 0 | 332 | | int rowID = RowEntriesFreeListHead; |
| | 0 | 333 | | int rowIDToDenseIndexMapLength = RowIDToDenseIndexMap?.Length ?? 0; |
| | 0 | 334 | | if (rowID >= rowIDToDenseIndexMapLength) |
| | 0 | 335 | | { |
| | 0 | 336 | | int newSize = rowID * 2; |
| | 0 | 337 | | newSize = newSize == 0 ? 1 : newSize; |
| | 0 | 338 | | Array.Resize(ref RowIDToDenseIndexMap, newSize); |
| | 0 | 339 | | for (int i = rowID; i < newSize; i++) |
| | 0 | 340 | | { |
| | 0 | 341 | | RowIDToDenseIndexMap[i] = i + 1; |
| | 0 | 342 | | } |
| | 0 | 343 | | } |
| | | 344 | | |
| | 0 | 345 | | int denseIndexToIDMapLength = RowDenseIndexToIDMap?.Length ?? 0; |
| | 0 | 346 | | Array.Resize(ref RowDenseIndexToIDMap, denseIndexToIDMapLength + 1); |
| | 0 | 347 | | Array.Resize(ref RowNames, denseIndexToIDMapLength + 1); |
| | | 348 | | |
| | 0 | 349 | | int insertAt = insertAtRowID < 0 ? RowCount : RowIDToDenseIndexMap[insertAtRowID]; |
| | | 350 | | |
| | 0 | 351 | | for (int i = denseIndexToIDMapLength; i > insertAt; i--) |
| | 0 | 352 | | { |
| | 0 | 353 | | int currentRowID = RowDenseIndexToIDMap[i - 1]; |
| | 0 | 354 | | RowDenseIndexToIDMap[i] = currentRowID; |
| | | 355 | | |
| | 0 | 356 | | RowIDToDenseIndexMap[currentRowID] = i; |
| | | 357 | | |
| | 0 | 358 | | RowNames[i] = RowNames[i - 1]; |
| | 0 | 359 | | } |
| | | 360 | | |
| | 0 | 361 | | RowEntriesFreeListHead = RowIDToDenseIndexMap[rowID]; |
| | 0 | 362 | | RowIDToDenseIndexMap[rowID] = insertAt; |
| | 0 | 363 | | RowDenseIndexToIDMap[insertAt] = rowID; |
| | 0 | 364 | | RowNames[insertAt] = rowName == null ? rowID.ToString() : rowName; |
| | | 365 | | |
| | 0 | 366 | | InsertRowsOfTypeInternal(ref AllStringColumns, insertAt, 1); |
| | 0 | 367 | | InsertRowsOfTypeInternal(ref AllBoolColumns, insertAt, 1); |
| | 0 | 368 | | InsertRowsOfTypeInternal(ref AllCharColumns, insertAt, 1); |
| | 0 | 369 | | InsertRowsOfTypeInternal(ref AllSbyteColumns, insertAt, 1); |
| | 0 | 370 | | InsertRowsOfTypeInternal(ref AllByteColumns, insertAt, 1); |
| | 0 | 371 | | InsertRowsOfTypeInternal(ref AllShortColumns, insertAt, 1); |
| | 0 | 372 | | InsertRowsOfTypeInternal(ref AllUshortColumns, insertAt, 1); |
| | 0 | 373 | | InsertRowsOfTypeInternal(ref AllIntColumns, insertAt, 1); |
| | 0 | 374 | | InsertRowsOfTypeInternal(ref AllUintColumns, insertAt, 1); |
| | 0 | 375 | | InsertRowsOfTypeInternal(ref AllLongColumns, insertAt, 1); |
| | 0 | 376 | | InsertRowsOfTypeInternal(ref AllUlongColumns, insertAt, 1); |
| | 0 | 377 | | InsertRowsOfTypeInternal(ref AllFloatColumns, insertAt, 1); |
| | 0 | 378 | | InsertRowsOfTypeInternal(ref AllDoubleColumns, insertAt, 1); |
| | 0 | 379 | | InsertRowsOfTypeInternal(ref AllVector2Columns, insertAt, 1); |
| | 0 | 380 | | InsertRowsOfTypeInternal(ref AllVector3Columns, insertAt, 1); |
| | 0 | 381 | | InsertRowsOfTypeInternal(ref AllVector4Columns, insertAt, 1); |
| | 0 | 382 | | InsertRowsOfTypeInternal(ref AllVector2IntColumns, insertAt, 1); |
| | 0 | 383 | | InsertRowsOfTypeInternal(ref AllVector3IntColumns, insertAt, 1); |
| | 0 | 384 | | InsertRowsOfTypeInternal(ref AllQuaternionColumns, insertAt, 1); |
| | 0 | 385 | | InsertRowsOfTypeInternal(ref AllRectColumns, insertAt, 1); |
| | 0 | 386 | | InsertRowsOfTypeInternal(ref AllRectIntColumns, insertAt, 1); |
| | 0 | 387 | | InsertRowsOfTypeInternal(ref AllColorColumns, insertAt, 1); |
| | 0 | 388 | | InsertRowsOfTypeInternal(ref AllLayerMaskColumns, insertAt, 1); |
| | 0 | 389 | | InsertRowsOfTypeInternal(ref AllBoundsColumns, insertAt, 1); |
| | 0 | 390 | | InsertRowsOfTypeInternal(ref AllBoundsIntColumns, insertAt, 1); |
| | 0 | 391 | | InsertRowsOfTypeInternal(ref AllHash128Columns, insertAt, 1); |
| | 0 | 392 | | InsertRowsOfTypeInternal(ref AllGradientColumns, insertAt, 1); |
| | 0 | 393 | | InsertRowsOfTypeInternal(ref AllAnimationCurveColumns, insertAt, 1); |
| | 0 | 394 | | InsertRowsOfTypeInternal(ref AllObjectRefColumns, insertAt, 1); |
| | | 395 | | |
| | 0 | 396 | | ++RowCount; |
| | 0 | 397 | | DataVersion++; |
| | | 398 | | |
| | 0 | 399 | | return rowID; |
| | 0 | 400 | | } |
| | | 401 | | |
| | | 402 | | public void AddRows(int numberOfNewRows, string[] rowNames = null, int insertAtRowID = -1) |
| | 0 | 403 | | { |
| | 0 | 404 | | if (insertAtRowID >= 0) |
| | 0 | 405 | | { |
| | 0 | 406 | | AssertRowIDValid(insertAtRowID); |
| | 0 | 407 | | } |
| | | 408 | | |
| | 0 | 409 | | int rowIDToDenseIndexMapLength = RowIDToDenseIndexMap?.Length ?? 0; |
| | 0 | 410 | | int newCount = RowCount + numberOfNewRows; |
| | 0 | 411 | | if (newCount > rowIDToDenseIndexMapLength) |
| | 0 | 412 | | { |
| | 0 | 413 | | int newSize = newCount; |
| | 0 | 414 | | --newSize; |
| | 0 | 415 | | newSize |= newSize >> 1; |
| | 0 | 416 | | newSize |= newSize >> 2; |
| | 0 | 417 | | newSize |= newSize >> 4; |
| | 0 | 418 | | newSize |= newSize >> 8; |
| | 0 | 419 | | newSize |= newSize >> 16; |
| | 0 | 420 | | ++newSize; |
| | | 421 | | |
| | 0 | 422 | | newSize = newSize == 0 ? 1 : newSize; |
| | 0 | 423 | | Array.Resize(ref RowIDToDenseIndexMap, newSize); |
| | 0 | 424 | | for (int i = rowIDToDenseIndexMapLength; i < newSize; i++) |
| | 0 | 425 | | { |
| | 0 | 426 | | RowIDToDenseIndexMap[i] = i + 1; |
| | 0 | 427 | | } |
| | 0 | 428 | | } |
| | | 429 | | |
| | 0 | 430 | | int denseIndexToIDMapLength = RowDenseIndexToIDMap?.Length ?? 0; |
| | 0 | 431 | | Array.Resize(ref RowDenseIndexToIDMap, denseIndexToIDMapLength + numberOfNewRows); |
| | 0 | 432 | | Array.Resize(ref rowNames, denseIndexToIDMapLength + numberOfNewRows); |
| | | 433 | | |
| | 0 | 434 | | int insertAt = insertAtRowID < 0 ? RowCount : RowIDToDenseIndexMap[insertAtRowID]; |
| | | 435 | | |
| | 0 | 436 | | for (int i = denseIndexToIDMapLength; i > insertAt + numberOfNewRows - 1; i--) |
| | 0 | 437 | | { |
| | 0 | 438 | | int currentRowID = RowDenseIndexToIDMap[i - numberOfNewRows]; |
| | 0 | 439 | | RowDenseIndexToIDMap[i] = currentRowID; |
| | | 440 | | |
| | 0 | 441 | | RowIDToDenseIndexMap[currentRowID] = i; |
| | | 442 | | |
| | 0 | 443 | | rowNames[i] = rowNames[i - numberOfNewRows]; |
| | 0 | 444 | | } |
| | | 445 | | |
| | 0 | 446 | | int freeListHead = RowEntriesFreeListHead; |
| | | 447 | | |
| | 0 | 448 | | for (int i = 0; i < numberOfNewRows; i++) |
| | 0 | 449 | | { |
| | 0 | 450 | | int rowID = freeListHead; |
| | 0 | 451 | | freeListHead = RowIDToDenseIndexMap[rowID]; |
| | 0 | 452 | | RowIDToDenseIndexMap[rowID] = insertAt + i; |
| | 0 | 453 | | RowDenseIndexToIDMap[insertAt + i] = rowID; |
| | 0 | 454 | | } |
| | | 455 | | |
| | 0 | 456 | | int numberOfNewRowNames = rowNames?.Length ?? 0; |
| | 0 | 457 | | string emptyString = string.Empty; |
| | 0 | 458 | | for (int i = 0; i < numberOfNewRowNames; i++) |
| | 0 | 459 | | { |
| | 0 | 460 | | string currentRowName = rowNames[i]; |
| | 0 | 461 | | int rowIDAt = RowDenseIndexToIDMap[insertAt + i]; |
| | 0 | 462 | | rowNames[insertAt + i] = currentRowName == null ? rowIDAt.ToString() : currentRowName; |
| | 0 | 463 | | } |
| | | 464 | | |
| | 0 | 465 | | for (int i = numberOfNewRowNames; i < numberOfNewRows; i++) |
| | 0 | 466 | | { |
| | 0 | 467 | | int rowIDAt = RowDenseIndexToIDMap[insertAt + i]; |
| | 0 | 468 | | rowNames[insertAt + i] = rowIDAt.ToString(); |
| | 0 | 469 | | } |
| | | 470 | | |
| | 0 | 471 | | RowEntriesFreeListHead = freeListHead; |
| | | 472 | | |
| | 0 | 473 | | InsertRowsOfTypeInternal(ref AllStringColumns, insertAt, numberOfNewRows); |
| | 0 | 474 | | InsertRowsOfTypeInternal(ref AllBoolColumns, insertAt, numberOfNewRows); |
| | 0 | 475 | | InsertRowsOfTypeInternal(ref AllCharColumns, insertAt, numberOfNewRows); |
| | 0 | 476 | | InsertRowsOfTypeInternal(ref AllSbyteColumns, insertAt, numberOfNewRows); |
| | 0 | 477 | | InsertRowsOfTypeInternal(ref AllByteColumns, insertAt, numberOfNewRows); |
| | 0 | 478 | | InsertRowsOfTypeInternal(ref AllShortColumns, insertAt, numberOfNewRows); |
| | 0 | 479 | | InsertRowsOfTypeInternal(ref AllUshortColumns, insertAt, numberOfNewRows); |
| | 0 | 480 | | InsertRowsOfTypeInternal(ref AllIntColumns, insertAt, numberOfNewRows); |
| | 0 | 481 | | InsertRowsOfTypeInternal(ref AllUintColumns, insertAt, numberOfNewRows); |
| | 0 | 482 | | InsertRowsOfTypeInternal(ref AllLongColumns, insertAt, numberOfNewRows); |
| | 0 | 483 | | InsertRowsOfTypeInternal(ref AllUlongColumns, insertAt, numberOfNewRows); |
| | 0 | 484 | | InsertRowsOfTypeInternal(ref AllFloatColumns, insertAt, numberOfNewRows); |
| | 0 | 485 | | InsertRowsOfTypeInternal(ref AllDoubleColumns, insertAt, numberOfNewRows); |
| | 0 | 486 | | InsertRowsOfTypeInternal(ref AllVector2Columns, insertAt, numberOfNewRows); |
| | 0 | 487 | | InsertRowsOfTypeInternal(ref AllVector3Columns, insertAt, numberOfNewRows); |
| | 0 | 488 | | InsertRowsOfTypeInternal(ref AllVector4Columns, insertAt, numberOfNewRows); |
| | 0 | 489 | | InsertRowsOfTypeInternal(ref AllVector2IntColumns, insertAt, numberOfNewRows); |
| | 0 | 490 | | InsertRowsOfTypeInternal(ref AllVector3IntColumns, insertAt, numberOfNewRows); |
| | 0 | 491 | | InsertRowsOfTypeInternal(ref AllQuaternionColumns, insertAt, numberOfNewRows); |
| | 0 | 492 | | InsertRowsOfTypeInternal(ref AllRectColumns, insertAt, numberOfNewRows); |
| | 0 | 493 | | InsertRowsOfTypeInternal(ref AllRectIntColumns, insertAt, numberOfNewRows); |
| | 0 | 494 | | InsertRowsOfTypeInternal(ref AllColorColumns, insertAt, numberOfNewRows); |
| | 0 | 495 | | InsertRowsOfTypeInternal(ref AllLayerMaskColumns, insertAt, numberOfNewRows); |
| | 0 | 496 | | InsertRowsOfTypeInternal(ref AllBoundsColumns, insertAt, numberOfNewRows); |
| | 0 | 497 | | InsertRowsOfTypeInternal(ref AllBoundsIntColumns, insertAt, numberOfNewRows); |
| | 0 | 498 | | InsertRowsOfTypeInternal(ref AllHash128Columns, insertAt, numberOfNewRows); |
| | 0 | 499 | | InsertRowsOfTypeInternal(ref AllGradientColumns, insertAt, numberOfNewRows); |
| | 0 | 500 | | InsertRowsOfTypeInternal(ref AllAnimationCurveColumns, insertAt, numberOfNewRows); |
| | 0 | 501 | | InsertRowsOfTypeInternal(ref AllObjectRefColumns, insertAt, numberOfNewRows); |
| | | 502 | | |
| | 0 | 503 | | RowCount += numberOfNewRows; |
| | 0 | 504 | | DataVersion++; |
| | 0 | 505 | | } |
| | | 506 | | |
| | | 507 | | public void AddRows(int numberOfNewRows, ref int[] rowIDs, string[] rowNames = null, int insertAtRowID = -1) |
| | 0 | 508 | | { |
| | 0 | 509 | | if (insertAtRowID >= 0) |
| | 0 | 510 | | { |
| | 0 | 511 | | AssertRowIDValid(insertAtRowID); |
| | 0 | 512 | | } |
| | | 513 | | |
| | 0 | 514 | | int rowIDToDenseIndexMapLength = RowIDToDenseIndexMap?.Length ?? 0; |
| | 0 | 515 | | int newCount = RowCount + numberOfNewRows; |
| | 0 | 516 | | if (newCount > rowIDToDenseIndexMapLength) |
| | 0 | 517 | | { |
| | 0 | 518 | | int newSize = newCount; |
| | 0 | 519 | | --newSize; |
| | 0 | 520 | | newSize |= newSize >> 1; |
| | 0 | 521 | | newSize |= newSize >> 2; |
| | 0 | 522 | | newSize |= newSize >> 4; |
| | 0 | 523 | | newSize |= newSize >> 8; |
| | 0 | 524 | | newSize |= newSize >> 16; |
| | 0 | 525 | | ++newSize; |
| | | 526 | | |
| | 0 | 527 | | newSize = newSize == 0 ? 1 : newSize; |
| | 0 | 528 | | Array.Resize(ref RowIDToDenseIndexMap, newSize); |
| | 0 | 529 | | for (int i = rowIDToDenseIndexMapLength; i < newSize; i++) |
| | 0 | 530 | | { |
| | 0 | 531 | | RowIDToDenseIndexMap[i] = i + 1; |
| | 0 | 532 | | } |
| | 0 | 533 | | } |
| | | 534 | | |
| | 0 | 535 | | int denseIndexToIDMapLength = RowDenseIndexToIDMap?.Length ?? 0; |
| | 0 | 536 | | Array.Resize(ref RowDenseIndexToIDMap, denseIndexToIDMapLength + numberOfNewRows); |
| | | 537 | | |
| | 0 | 538 | | int insertAt = insertAtRowID < 0 ? RowCount : RowIDToDenseIndexMap[insertAtRowID]; |
| | | 539 | | |
| | 0 | 540 | | for (int i = denseIndexToIDMapLength; i > insertAt + numberOfNewRows - 1; i--) |
| | 0 | 541 | | { |
| | 0 | 542 | | int currentRowID = RowDenseIndexToIDMap[i - numberOfNewRows]; |
| | 0 | 543 | | RowDenseIndexToIDMap[i] = currentRowID; |
| | | 544 | | |
| | 0 | 545 | | RowIDToDenseIndexMap[currentRowID] = i; |
| | | 546 | | |
| | 0 | 547 | | rowNames[i] = rowNames[i - numberOfNewRows]; |
| | 0 | 548 | | } |
| | | 549 | | |
| | 0 | 550 | | int freeListHead = RowEntriesFreeListHead; |
| | | 551 | | |
| | 0 | 552 | | for (int i = 0; i < numberOfNewRows; i++) |
| | 0 | 553 | | { |
| | 0 | 554 | | int rowID = freeListHead; |
| | 0 | 555 | | freeListHead = RowIDToDenseIndexMap[rowID]; |
| | 0 | 556 | | RowIDToDenseIndexMap[rowID] = insertAt + i; |
| | 0 | 557 | | RowDenseIndexToIDMap[insertAt + i] = rowID; |
| | 0 | 558 | | rowIDs[i] = rowID; |
| | 0 | 559 | | } |
| | | 560 | | |
| | 0 | 561 | | int numberOfNewRowNames = rowNames?.Length ?? 0; |
| | 0 | 562 | | for (int i = 0; i < numberOfNewRowNames; i++) |
| | 0 | 563 | | { |
| | 0 | 564 | | string currentRowName = rowNames[i]; |
| | 0 | 565 | | int rowIDAt = RowDenseIndexToIDMap[insertAt + i]; |
| | 0 | 566 | | rowNames[insertAt + i] = currentRowName == null ? rowIDAt.ToString() : currentRowName; |
| | 0 | 567 | | } |
| | | 568 | | |
| | 0 | 569 | | for (int i = numberOfNewRowNames; i < numberOfNewRows; i++) |
| | 0 | 570 | | { |
| | 0 | 571 | | int rowIDAt = RowDenseIndexToIDMap[insertAt + i]; |
| | 0 | 572 | | rowNames[insertAt + i] = rowIDAt.ToString(); |
| | 0 | 573 | | } |
| | | 574 | | |
| | 0 | 575 | | RowEntriesFreeListHead = freeListHead; |
| | | 576 | | |
| | 0 | 577 | | InsertRowsOfTypeInternal(ref AllStringColumns, insertAt, numberOfNewRows); |
| | 0 | 578 | | InsertRowsOfTypeInternal(ref AllBoolColumns, insertAt, numberOfNewRows); |
| | 0 | 579 | | InsertRowsOfTypeInternal(ref AllCharColumns, insertAt, numberOfNewRows); |
| | 0 | 580 | | InsertRowsOfTypeInternal(ref AllSbyteColumns, insertAt, numberOfNewRows); |
| | 0 | 581 | | InsertRowsOfTypeInternal(ref AllByteColumns, insertAt, numberOfNewRows); |
| | 0 | 582 | | InsertRowsOfTypeInternal(ref AllShortColumns, insertAt, numberOfNewRows); |
| | 0 | 583 | | InsertRowsOfTypeInternal(ref AllUshortColumns, insertAt, numberOfNewRows); |
| | 0 | 584 | | InsertRowsOfTypeInternal(ref AllIntColumns, insertAt, numberOfNewRows); |
| | 0 | 585 | | InsertRowsOfTypeInternal(ref AllUintColumns, insertAt, numberOfNewRows); |
| | 0 | 586 | | InsertRowsOfTypeInternal(ref AllLongColumns, insertAt, numberOfNewRows); |
| | 0 | 587 | | InsertRowsOfTypeInternal(ref AllUlongColumns, insertAt, numberOfNewRows); |
| | 0 | 588 | | InsertRowsOfTypeInternal(ref AllFloatColumns, insertAt, numberOfNewRows); |
| | 0 | 589 | | InsertRowsOfTypeInternal(ref AllDoubleColumns, insertAt, numberOfNewRows); |
| | 0 | 590 | | InsertRowsOfTypeInternal(ref AllVector2Columns, insertAt, numberOfNewRows); |
| | 0 | 591 | | InsertRowsOfTypeInternal(ref AllVector3Columns, insertAt, numberOfNewRows); |
| | 0 | 592 | | InsertRowsOfTypeInternal(ref AllVector4Columns, insertAt, numberOfNewRows); |
| | 0 | 593 | | InsertRowsOfTypeInternal(ref AllVector2IntColumns, insertAt, numberOfNewRows); |
| | 0 | 594 | | InsertRowsOfTypeInternal(ref AllVector3IntColumns, insertAt, numberOfNewRows); |
| | 0 | 595 | | InsertRowsOfTypeInternal(ref AllQuaternionColumns, insertAt, numberOfNewRows); |
| | 0 | 596 | | InsertRowsOfTypeInternal(ref AllRectColumns, insertAt, numberOfNewRows); |
| | 0 | 597 | | InsertRowsOfTypeInternal(ref AllRectIntColumns, insertAt, numberOfNewRows); |
| | 0 | 598 | | InsertRowsOfTypeInternal(ref AllColorColumns, insertAt, numberOfNewRows); |
| | 0 | 599 | | InsertRowsOfTypeInternal(ref AllLayerMaskColumns, insertAt, numberOfNewRows); |
| | 0 | 600 | | InsertRowsOfTypeInternal(ref AllBoundsColumns, insertAt, numberOfNewRows); |
| | 0 | 601 | | InsertRowsOfTypeInternal(ref AllBoundsIntColumns, insertAt, numberOfNewRows); |
| | 0 | 602 | | InsertRowsOfTypeInternal(ref AllHash128Columns, insertAt, numberOfNewRows); |
| | 0 | 603 | | InsertRowsOfTypeInternal(ref AllGradientColumns, insertAt, numberOfNewRows); |
| | 0 | 604 | | InsertRowsOfTypeInternal(ref AllAnimationCurveColumns, insertAt, numberOfNewRows); |
| | 0 | 605 | | InsertRowsOfTypeInternal(ref AllObjectRefColumns, insertAt, numberOfNewRows); |
| | | 606 | | |
| | 0 | 607 | | RowCount += numberOfNewRows; |
| | 0 | 608 | | DataVersion++; |
| | 0 | 609 | | } |
| | | 610 | | |
| | | 611 | | /// <inheritdoc /> |
| | | 612 | | public override void RemoveRow(int rowID) |
| | 0 | 613 | | { |
| | 0 | 614 | | AssertRowIDValid(rowID); |
| | 0 | 615 | | int rowDenseIndex = RowIDToDenseIndexMap[rowID]; |
| | 0 | 616 | | for (int i = rowDenseIndex + 1; i < RowCount; i++) |
| | 0 | 617 | | { |
| | 0 | 618 | | int currentRowID = RowDenseIndexToIDMap[i]; |
| | 0 | 619 | | RowIDToDenseIndexMap[currentRowID] = i - 1; |
| | 0 | 620 | | RowDenseIndexToIDMap[i - 1] = currentRowID; |
| | 0 | 621 | | RowNames[i - 1] = RowNames[i]; |
| | 0 | 622 | | } |
| | | 623 | | |
| | 0 | 624 | | RowIDToDenseIndexMap[rowID] = RowEntriesFreeListHead; |
| | 0 | 625 | | RowEntriesFreeListHead = rowID; |
| | 0 | 626 | | Array.Resize(ref RowDenseIndexToIDMap, RowCount - 1); |
| | 0 | 627 | | Array.Resize(ref RowNames, RowCount - 1); |
| | | 628 | | |
| | 0 | 629 | | DeleteRowsOfTypeInternal(ref AllStringColumns, rowID, 1); |
| | 0 | 630 | | DeleteRowsOfTypeInternal(ref AllBoolColumns, rowID, 1); |
| | 0 | 631 | | DeleteRowsOfTypeInternal(ref AllCharColumns, rowID, 1); |
| | 0 | 632 | | DeleteRowsOfTypeInternal(ref AllSbyteColumns, rowID, 1); |
| | 0 | 633 | | DeleteRowsOfTypeInternal(ref AllByteColumns, rowID, 1); |
| | 0 | 634 | | DeleteRowsOfTypeInternal(ref AllShortColumns, rowID, 1); |
| | 0 | 635 | | DeleteRowsOfTypeInternal(ref AllUshortColumns, rowID, 1); |
| | 0 | 636 | | DeleteRowsOfTypeInternal(ref AllIntColumns, rowID, 1); |
| | 0 | 637 | | DeleteRowsOfTypeInternal(ref AllUintColumns, rowID, 1); |
| | 0 | 638 | | DeleteRowsOfTypeInternal(ref AllLongColumns, rowID, 1); |
| | 0 | 639 | | DeleteRowsOfTypeInternal(ref AllUlongColumns, rowID, 1); |
| | 0 | 640 | | DeleteRowsOfTypeInternal(ref AllFloatColumns, rowID, 1); |
| | 0 | 641 | | DeleteRowsOfTypeInternal(ref AllDoubleColumns, rowID, 1); |
| | 0 | 642 | | DeleteRowsOfTypeInternal(ref AllVector2Columns, rowID, 1); |
| | 0 | 643 | | DeleteRowsOfTypeInternal(ref AllVector3Columns, rowID, 1); |
| | 0 | 644 | | DeleteRowsOfTypeInternal(ref AllVector4Columns, rowID, 1); |
| | 0 | 645 | | DeleteRowsOfTypeInternal(ref AllVector2IntColumns, rowID, 1); |
| | 0 | 646 | | DeleteRowsOfTypeInternal(ref AllVector3IntColumns, rowID, 1); |
| | 0 | 647 | | DeleteRowsOfTypeInternal(ref AllQuaternionColumns, rowID, 1); |
| | 0 | 648 | | DeleteRowsOfTypeInternal(ref AllRectColumns, rowID, 1); |
| | 0 | 649 | | DeleteRowsOfTypeInternal(ref AllRectIntColumns, rowID, 1); |
| | 0 | 650 | | DeleteRowsOfTypeInternal(ref AllColorColumns, rowID, 1); |
| | 0 | 651 | | DeleteRowsOfTypeInternal(ref AllLayerMaskColumns, rowID, 1); |
| | 0 | 652 | | DeleteRowsOfTypeInternal(ref AllBoundsColumns, rowID, 1); |
| | 0 | 653 | | DeleteRowsOfTypeInternal(ref AllBoundsIntColumns, rowID, 1); |
| | 0 | 654 | | DeleteRowsOfTypeInternal(ref AllHash128Columns, rowID, 1); |
| | 0 | 655 | | DeleteRowsOfTypeInternal(ref AllGradientColumns, rowID, 1); |
| | 0 | 656 | | DeleteRowsOfTypeInternal(ref AllAnimationCurveColumns, rowID, 1); |
| | 0 | 657 | | DeleteRowsOfTypeInternal(ref AllObjectRefColumns, rowID, 1); |
| | | 658 | | |
| | 0 | 659 | | --RowCount; |
| | 0 | 660 | | DataVersion++; |
| | 0 | 661 | | } |
| | | 662 | | |
| | | 663 | | /// <inheritdoc /> |
| | | 664 | | public override int AddColumn(Serializable.SerializableTypes columnType, string columnName, |
| | | 665 | | int insertAtColumnID = -1) |
| | 0 | 666 | | { |
| | 0 | 667 | | switch (columnType) |
| | | 668 | | { |
| | | 669 | | case Serializable.SerializableTypes.String: |
| | 0 | 670 | | return AddColumnInternal(columnName, ref AllStringColumns, Serializable.SerializableTypes.String, |
| | | 671 | | insertAtColumnID); |
| | | 672 | | case Serializable.SerializableTypes.Char: |
| | 0 | 673 | | return AddColumnInternal(columnName, ref AllCharColumns, Serializable.SerializableTypes.Char, |
| | | 674 | | insertAtColumnID); |
| | | 675 | | case Serializable.SerializableTypes.Bool: |
| | 0 | 676 | | return AddColumnInternal(columnName, ref AllBoolColumns, Serializable.SerializableTypes.Bool, |
| | | 677 | | insertAtColumnID); |
| | | 678 | | case Serializable.SerializableTypes.SByte: |
| | 0 | 679 | | return AddColumnInternal(columnName, ref AllSbyteColumns, Serializable.SerializableTypes.SByte, |
| | | 680 | | insertAtColumnID); |
| | | 681 | | case Serializable.SerializableTypes.Byte: |
| | 0 | 682 | | return AddColumnInternal(columnName, ref AllByteColumns, Serializable.SerializableTypes.Byte, |
| | | 683 | | insertAtColumnID); |
| | | 684 | | case Serializable.SerializableTypes.Short: |
| | 0 | 685 | | return AddColumnInternal(columnName, ref AllShortColumns, Serializable.SerializableTypes.Short, |
| | | 686 | | insertAtColumnID); |
| | | 687 | | case Serializable.SerializableTypes.UShort: |
| | 0 | 688 | | return AddColumnInternal(columnName, ref AllUshortColumns, Serializable.SerializableTypes.UShort, |
| | | 689 | | insertAtColumnID); |
| | | 690 | | case Serializable.SerializableTypes.Int: |
| | 0 | 691 | | return AddColumnInternal(columnName, ref AllIntColumns, Serializable.SerializableTypes.Int, |
| | | 692 | | insertAtColumnID); |
| | | 693 | | case Serializable.SerializableTypes.UInt: |
| | 0 | 694 | | return AddColumnInternal(columnName, ref AllUintColumns, Serializable.SerializableTypes.UInt, |
| | | 695 | | insertAtColumnID); |
| | | 696 | | case Serializable.SerializableTypes.Long: |
| | 0 | 697 | | return AddColumnInternal(columnName, ref AllLongColumns, Serializable.SerializableTypes.Long, |
| | | 698 | | insertAtColumnID); |
| | | 699 | | case Serializable.SerializableTypes.ULong: |
| | 0 | 700 | | return AddColumnInternal(columnName, ref AllUlongColumns, Serializable.SerializableTypes.ULong, |
| | | 701 | | insertAtColumnID); |
| | | 702 | | case Serializable.SerializableTypes.Float: |
| | 0 | 703 | | return AddColumnInternal(columnName, ref AllFloatColumns, Serializable.SerializableTypes.Float, |
| | | 704 | | insertAtColumnID); |
| | | 705 | | case Serializable.SerializableTypes.Double: |
| | 0 | 706 | | return AddColumnInternal(columnName, ref AllDoubleColumns, Serializable.SerializableTypes.Double, |
| | | 707 | | insertAtColumnID); |
| | | 708 | | case Serializable.SerializableTypes.Vector2: |
| | 0 | 709 | | return AddColumnInternal(columnName, ref AllVector2Columns, Serializable.SerializableTypes.Vector2, |
| | | 710 | | insertAtColumnID); |
| | | 711 | | case Serializable.SerializableTypes.Vector3: |
| | 0 | 712 | | return AddColumnInternal(columnName, ref AllVector3Columns, Serializable.SerializableTypes.Vector3, |
| | | 713 | | insertAtColumnID); |
| | | 714 | | case Serializable.SerializableTypes.Vector4: |
| | 0 | 715 | | return AddColumnInternal(columnName, ref AllVector4Columns, Serializable.SerializableTypes.Vector4, |
| | | 716 | | insertAtColumnID); |
| | | 717 | | case Serializable.SerializableTypes.Vector2Int: |
| | 0 | 718 | | return AddColumnInternal(columnName, ref AllVector2IntColumns, |
| | | 719 | | Serializable.SerializableTypes.Vector2Int, insertAtColumnID); |
| | | 720 | | case Serializable.SerializableTypes.Vector3Int: |
| | 0 | 721 | | return AddColumnInternal(columnName, ref AllVector3IntColumns, |
| | | 722 | | Serializable.SerializableTypes.Vector3Int, insertAtColumnID); |
| | | 723 | | case Serializable.SerializableTypes.Quaternion: |
| | 0 | 724 | | return AddColumnInternal(columnName, ref AllQuaternionColumns, |
| | | 725 | | Serializable.SerializableTypes.Quaternion, insertAtColumnID); |
| | | 726 | | case Serializable.SerializableTypes.Rect: |
| | 0 | 727 | | return AddColumnInternal(columnName, ref AllRectColumns, Serializable.SerializableTypes.Rect, |
| | | 728 | | insertAtColumnID); |
| | | 729 | | case Serializable.SerializableTypes.RectInt: |
| | 0 | 730 | | return AddColumnInternal(columnName, ref AllRectIntColumns, Serializable.SerializableTypes.RectInt, |
| | | 731 | | insertAtColumnID); |
| | | 732 | | case Serializable.SerializableTypes.Color: |
| | 0 | 733 | | return AddColumnInternal(columnName, ref AllColorColumns, Serializable.SerializableTypes.Color, |
| | | 734 | | insertAtColumnID); |
| | | 735 | | case Serializable.SerializableTypes.LayerMask: |
| | 0 | 736 | | return AddColumnInternal(columnName, ref AllLayerMaskColumns, |
| | | 737 | | Serializable.SerializableTypes.LayerMask, insertAtColumnID); |
| | | 738 | | case Serializable.SerializableTypes.Bounds: |
| | 0 | 739 | | return AddColumnInternal(columnName, ref AllBoundsColumns, Serializable.SerializableTypes.Bounds, |
| | | 740 | | insertAtColumnID); |
| | | 741 | | case Serializable.SerializableTypes.BoundsInt: |
| | 0 | 742 | | return AddColumnInternal(columnName, ref AllBoundsIntColumns, |
| | | 743 | | Serializable.SerializableTypes.BoundsInt, insertAtColumnID); |
| | | 744 | | case Serializable.SerializableTypes.Hash128: |
| | 0 | 745 | | return AddColumnInternal(columnName, ref AllHash128Columns, Serializable.SerializableTypes.Hash128, |
| | | 746 | | insertAtColumnID); |
| | | 747 | | case Serializable.SerializableTypes.Gradient: |
| | 0 | 748 | | return AddColumnInternal(columnName, ref AllGradientColumns, |
| | | 749 | | Serializable.SerializableTypes.Gradient, insertAtColumnID); |
| | | 750 | | case Serializable.SerializableTypes.AnimationCurve: |
| | 0 | 751 | | return AddColumnInternal(columnName, ref AllAnimationCurveColumns, |
| | | 752 | | Serializable.SerializableTypes.AnimationCurve, insertAtColumnID); |
| | | 753 | | case Serializable.SerializableTypes.Object: |
| | 0 | 754 | | return AddColumnInternal(columnName, ref AllObjectRefColumns, Serializable.SerializableTypes.Object, |
| | | 755 | | insertAtColumnID); |
| | | 756 | | } |
| | | 757 | | |
| | 0 | 758 | | return -1; |
| | 0 | 759 | | } |
| | | 760 | | |
| | | 761 | | /// <inheritdoc /> |
| | | 762 | | public override void RemoveColumn(Serializable.SerializableTypes columnType, int columnID) |
| | 0 | 763 | | { |
| | 0 | 764 | | switch (columnType) |
| | | 765 | | { |
| | | 766 | | case Serializable.SerializableTypes.String: |
| | 0 | 767 | | RemoveColumnInternal(ref AllStringColumns, Serializable.SerializableTypes.String, columnID); |
| | 0 | 768 | | break; |
| | | 769 | | case Serializable.SerializableTypes.Char: |
| | 0 | 770 | | RemoveColumnInternal(ref AllCharColumns, Serializable.SerializableTypes.Char, columnID); |
| | 0 | 771 | | break; |
| | | 772 | | case Serializable.SerializableTypes.Bool: |
| | 0 | 773 | | RemoveColumnInternal(ref AllBoolColumns, Serializable.SerializableTypes.Bool, columnID); |
| | 0 | 774 | | break; |
| | | 775 | | case Serializable.SerializableTypes.SByte: |
| | 0 | 776 | | RemoveColumnInternal(ref AllSbyteColumns, Serializable.SerializableTypes.SByte, columnID); |
| | 0 | 777 | | break; |
| | | 778 | | case Serializable.SerializableTypes.Byte: |
| | 0 | 779 | | RemoveColumnInternal(ref AllByteColumns, Serializable.SerializableTypes.Byte, columnID); |
| | 0 | 780 | | break; |
| | | 781 | | case Serializable.SerializableTypes.Short: |
| | 0 | 782 | | RemoveColumnInternal(ref AllShortColumns, Serializable.SerializableTypes.Short, columnID); |
| | 0 | 783 | | break; |
| | | 784 | | case Serializable.SerializableTypes.UShort: |
| | 0 | 785 | | RemoveColumnInternal(ref AllUshortColumns, Serializable.SerializableTypes.UShort, columnID); |
| | 0 | 786 | | break; |
| | | 787 | | case Serializable.SerializableTypes.Int: |
| | 0 | 788 | | RemoveColumnInternal(ref AllIntColumns, Serializable.SerializableTypes.Int, columnID); |
| | 0 | 789 | | break; |
| | | 790 | | case Serializable.SerializableTypes.UInt: |
| | 0 | 791 | | RemoveColumnInternal(ref AllUintColumns, Serializable.SerializableTypes.UInt, columnID); |
| | 0 | 792 | | break; |
| | | 793 | | case Serializable.SerializableTypes.Long: |
| | 0 | 794 | | RemoveColumnInternal(ref AllLongColumns, Serializable.SerializableTypes.Long, columnID); |
| | 0 | 795 | | break; |
| | | 796 | | case Serializable.SerializableTypes.ULong: |
| | 0 | 797 | | RemoveColumnInternal(ref AllUlongColumns, Serializable.SerializableTypes.ULong, columnID); |
| | 0 | 798 | | break; |
| | | 799 | | case Serializable.SerializableTypes.Float: |
| | 0 | 800 | | RemoveColumnInternal(ref AllFloatColumns, Serializable.SerializableTypes.Float, columnID); |
| | 0 | 801 | | break; |
| | | 802 | | case Serializable.SerializableTypes.Double: |
| | 0 | 803 | | RemoveColumnInternal(ref AllDoubleColumns, Serializable.SerializableTypes.Double, columnID); |
| | 0 | 804 | | break; |
| | | 805 | | case Serializable.SerializableTypes.Vector2: |
| | 0 | 806 | | RemoveColumnInternal(ref AllVector2Columns, Serializable.SerializableTypes.Vector2, columnID); |
| | 0 | 807 | | break; |
| | | 808 | | case Serializable.SerializableTypes.Vector3: |
| | 0 | 809 | | RemoveColumnInternal(ref AllVector3Columns, Serializable.SerializableTypes.Vector3, columnID); |
| | 0 | 810 | | break; |
| | | 811 | | case Serializable.SerializableTypes.Vector4: |
| | 0 | 812 | | RemoveColumnInternal(ref AllVector4Columns, Serializable.SerializableTypes.Vector4, columnID); |
| | 0 | 813 | | break; |
| | | 814 | | case Serializable.SerializableTypes.Vector2Int: |
| | 0 | 815 | | RemoveColumnInternal(ref AllVector2IntColumns, Serializable.SerializableTypes.Vector2Int, columnID); |
| | 0 | 816 | | break; |
| | | 817 | | case Serializable.SerializableTypes.Vector3Int: |
| | 0 | 818 | | RemoveColumnInternal(ref AllVector3IntColumns, Serializable.SerializableTypes.Vector3Int, columnID); |
| | 0 | 819 | | break; |
| | | 820 | | case Serializable.SerializableTypes.Quaternion: |
| | 0 | 821 | | RemoveColumnInternal(ref AllQuaternionColumns, Serializable.SerializableTypes.Quaternion, columnID); |
| | 0 | 822 | | break; |
| | | 823 | | case Serializable.SerializableTypes.Rect: |
| | 0 | 824 | | RemoveColumnInternal(ref AllRectColumns, Serializable.SerializableTypes.Rect, columnID); |
| | 0 | 825 | | break; |
| | | 826 | | case Serializable.SerializableTypes.RectInt: |
| | 0 | 827 | | RemoveColumnInternal(ref AllRectIntColumns, Serializable.SerializableTypes.RectInt, columnID); |
| | 0 | 828 | | break; |
| | | 829 | | case Serializable.SerializableTypes.Color: |
| | 0 | 830 | | RemoveColumnInternal(ref AllColorColumns, Serializable.SerializableTypes.Color, columnID); |
| | 0 | 831 | | break; |
| | | 832 | | case Serializable.SerializableTypes.LayerMask: |
| | 0 | 833 | | RemoveColumnInternal(ref AllLayerMaskColumns, Serializable.SerializableTypes.LayerMask, columnID); |
| | 0 | 834 | | break; |
| | | 835 | | case Serializable.SerializableTypes.Bounds: |
| | 0 | 836 | | RemoveColumnInternal(ref AllBoundsColumns, Serializable.SerializableTypes.Bounds, columnID); |
| | 0 | 837 | | break; |
| | | 838 | | case Serializable.SerializableTypes.BoundsInt: |
| | 0 | 839 | | RemoveColumnInternal(ref AllBoundsIntColumns, Serializable.SerializableTypes.BoundsInt, columnID); |
| | 0 | 840 | | break; |
| | | 841 | | case Serializable.SerializableTypes.Hash128: |
| | 0 | 842 | | RemoveColumnInternal(ref AllHash128Columns, Serializable.SerializableTypes.Hash128, columnID); |
| | 0 | 843 | | break; |
| | | 844 | | case Serializable.SerializableTypes.Gradient: |
| | 0 | 845 | | RemoveColumnInternal(ref AllGradientColumns, Serializable.SerializableTypes.Gradient, columnID); |
| | 0 | 846 | | break; |
| | | 847 | | case Serializable.SerializableTypes.AnimationCurve: |
| | 0 | 848 | | RemoveColumnInternal(ref AllAnimationCurveColumns, Serializable.SerializableTypes.AnimationCurve, |
| | | 849 | | columnID); |
| | 0 | 850 | | break; |
| | | 851 | | case Serializable.SerializableTypes.Object: |
| | 0 | 852 | | RemoveColumnInternal(ref AllObjectRefColumns, Serializable.SerializableTypes.Object, columnID); |
| | 0 | 853 | | break; |
| | | 854 | | } |
| | 0 | 855 | | } |
| | | 856 | | |
| | | 857 | | // Set |
| | | 858 | | /// <inheritdoc /> |
| | | 859 | | public override ulong SetString(int rowIdentifier, int columnIdentifier, string newValue) |
| | 0 | 860 | | { |
| | 0 | 861 | | return SetCell(rowIdentifier, columnIdentifier, ref AllStringColumns, newValue); |
| | 0 | 862 | | } |
| | | 863 | | |
| | | 864 | | /// <inheritdoc /> |
| | | 865 | | public override ulong SetBool(int rowIdentifier, int columnIdentifier, bool newValue) |
| | 0 | 866 | | { |
| | 0 | 867 | | return SetCell(rowIdentifier, columnIdentifier, ref AllBoolColumns, newValue); |
| | 0 | 868 | | } |
| | | 869 | | |
| | | 870 | | /// <inheritdoc /> |
| | | 871 | | public override ulong SetChar(int rowIdentifier, int columnIdentifier, char newValue) |
| | 0 | 872 | | { |
| | 0 | 873 | | return SetCell(rowIdentifier, columnIdentifier, ref AllCharColumns, newValue); |
| | 0 | 874 | | } |
| | | 875 | | |
| | | 876 | | /// <inheritdoc /> |
| | | 877 | | public override ulong SetSByte(int rowIdentifier, int columnIdentifier, sbyte newValue) |
| | 0 | 878 | | { |
| | 0 | 879 | | return SetCell(rowIdentifier, columnIdentifier, ref AllSbyteColumns, newValue); |
| | 0 | 880 | | } |
| | | 881 | | |
| | | 882 | | /// <inheritdoc /> |
| | | 883 | | public override ulong SetByte(int rowIdentifier, int columnIdentifier, byte newValue) |
| | 0 | 884 | | { |
| | 0 | 885 | | return SetCell(rowIdentifier, columnIdentifier, ref AllByteColumns, newValue); |
| | 0 | 886 | | } |
| | | 887 | | |
| | | 888 | | /// <inheritdoc /> |
| | | 889 | | public override ulong SetShort(int rowIdentifier, int columnIdentifier, short newValue) |
| | 0 | 890 | | { |
| | 0 | 891 | | return SetCell(rowIdentifier, columnIdentifier, ref AllShortColumns, newValue); |
| | 0 | 892 | | } |
| | | 893 | | |
| | | 894 | | /// <inheritdoc /> |
| | | 895 | | public override ulong SetUShort(int rowIdentifier, int columnIdentifier, ushort newValue) |
| | 0 | 896 | | { |
| | 0 | 897 | | return SetCell(rowIdentifier, columnIdentifier, ref AllUshortColumns, newValue); |
| | 0 | 898 | | } |
| | | 899 | | |
| | | 900 | | /// <inheritdoc /> |
| | | 901 | | public override ulong SetInt(int rowIdentifier, int columnIdentifier, int newValue) |
| | 0 | 902 | | { |
| | 0 | 903 | | return SetCell(rowIdentifier, columnIdentifier, ref AllIntColumns, newValue); |
| | 0 | 904 | | } |
| | | 905 | | |
| | | 906 | | /// <inheritdoc /> |
| | | 907 | | public override ulong SetUInt(int rowIdentifier, int columnIdentifier, uint newValue) |
| | 0 | 908 | | { |
| | 0 | 909 | | return SetCell(rowIdentifier, columnIdentifier, ref AllUintColumns, newValue); |
| | 0 | 910 | | } |
| | | 911 | | |
| | | 912 | | /// <inheritdoc /> |
| | | 913 | | public override ulong SetLong(int rowIdentifier, int columnIdentifier, long newValue) |
| | 0 | 914 | | { |
| | 0 | 915 | | return SetCell(rowIdentifier, columnIdentifier, ref AllLongColumns, newValue); |
| | 0 | 916 | | } |
| | | 917 | | |
| | | 918 | | /// <inheritdoc /> |
| | | 919 | | public override ulong SetULong(int rowIdentifier, int columnIdentifier, ulong newValue) |
| | 0 | 920 | | { |
| | 0 | 921 | | return SetCell(rowIdentifier, columnIdentifier, ref AllUlongColumns, newValue); |
| | 0 | 922 | | } |
| | | 923 | | |
| | | 924 | | /// <inheritdoc /> |
| | | 925 | | public override ulong SetFloat(int rowIdentifier, int columnIdentifier, float newValue) |
| | 0 | 926 | | { |
| | 0 | 927 | | return SetCell(rowIdentifier, columnIdentifier, ref AllFloatColumns, newValue); |
| | 0 | 928 | | } |
| | | 929 | | |
| | | 930 | | /// <inheritdoc /> |
| | | 931 | | public override ulong SetDouble(int rowIdentifier, int columnIdentifier, double newValue) |
| | 0 | 932 | | { |
| | 0 | 933 | | return SetCell(rowIdentifier, columnIdentifier, ref AllDoubleColumns, newValue); |
| | 0 | 934 | | } |
| | | 935 | | |
| | | 936 | | /// <inheritdoc /> |
| | | 937 | | public override ulong SetVector2(int rowIdentifier, int columnIdentifier, Vector2 newValue) |
| | 0 | 938 | | { |
| | 0 | 939 | | return SetCell(rowIdentifier, columnIdentifier, ref AllVector2Columns, newValue); |
| | 0 | 940 | | } |
| | | 941 | | |
| | | 942 | | /// <inheritdoc /> |
| | | 943 | | public override ulong SetVector3(int rowIdentifier, int columnIdentifier, Vector3 newValue) |
| | 0 | 944 | | { |
| | 0 | 945 | | return SetCell(rowIdentifier, columnIdentifier, ref AllVector3Columns, newValue); |
| | 0 | 946 | | } |
| | | 947 | | |
| | | 948 | | /// <inheritdoc /> |
| | | 949 | | public override ulong SetVector4(int rowIdentifier, int columnIdentifier, Vector4 value) |
| | 0 | 950 | | { |
| | 0 | 951 | | return SetCell(rowIdentifier, columnIdentifier, ref AllVector4Columns, value); |
| | 0 | 952 | | } |
| | | 953 | | |
| | | 954 | | /// <inheritdoc /> |
| | | 955 | | public override ulong SetVector2Int(int rowIdentifier, int columnIdentifier, Vector2Int newValue) |
| | 0 | 956 | | { |
| | 0 | 957 | | return SetCell(rowIdentifier, columnIdentifier, ref AllVector2IntColumns, newValue); |
| | 0 | 958 | | } |
| | | 959 | | |
| | | 960 | | /// <inheritdoc /> |
| | | 961 | | public override ulong SetVector3Int(int rowIdentifier, int columnIdentifier, Vector3Int newValue) |
| | 0 | 962 | | { |
| | 0 | 963 | | return SetCell(rowIdentifier, columnIdentifier, ref AllVector3IntColumns, newValue); |
| | 0 | 964 | | } |
| | | 965 | | |
| | | 966 | | /// <inheritdoc /> |
| | | 967 | | public override ulong SetQuaternion(int rowIdentifier, int columnIdentifier, Quaternion newValue) |
| | 0 | 968 | | { |
| | 0 | 969 | | return SetCell(rowIdentifier, columnIdentifier, ref AllQuaternionColumns, newValue); |
| | 0 | 970 | | } |
| | | 971 | | |
| | | 972 | | /// <inheritdoc /> |
| | | 973 | | public override ulong SetRect(int rowIdentifier, int columnIdentifier, Rect newValue) |
| | 0 | 974 | | { |
| | 0 | 975 | | return SetCell(rowIdentifier, columnIdentifier, ref AllRectColumns, newValue); |
| | 0 | 976 | | } |
| | | 977 | | |
| | | 978 | | /// <inheritdoc /> |
| | | 979 | | public override ulong SetRectInt(int rowIdentifier, int columnIdentifier, RectInt newValue) |
| | 0 | 980 | | { |
| | 0 | 981 | | return SetCell(rowIdentifier, columnIdentifier, ref AllRectIntColumns, newValue); |
| | 0 | 982 | | } |
| | | 983 | | |
| | | 984 | | /// <inheritdoc /> |
| | | 985 | | public override ulong SetColor(int rowIdentifier, int columnIdentifier, Color newValue) |
| | 0 | 986 | | { |
| | 0 | 987 | | return SetCell(rowIdentifier, columnIdentifier, ref AllColorColumns, newValue); |
| | 0 | 988 | | } |
| | | 989 | | |
| | | 990 | | /// <inheritdoc /> |
| | | 991 | | public override ulong SetLayerMask(int rowIdentifier, int columnIdentifier, LayerMask newValue) |
| | 0 | 992 | | { |
| | 0 | 993 | | return SetCell(rowIdentifier, columnIdentifier, ref AllLayerMaskColumns, newValue); |
| | 0 | 994 | | } |
| | | 995 | | |
| | | 996 | | /// <inheritdoc /> |
| | | 997 | | public override ulong SetBounds(int rowIdentifier, int columnIdentifier, Bounds newValue) |
| | 0 | 998 | | { |
| | 0 | 999 | | return SetCell(rowIdentifier, columnIdentifier, ref AllBoundsColumns, newValue); |
| | 0 | 1000 | | } |
| | | 1001 | | |
| | | 1002 | | /// <inheritdoc /> |
| | | 1003 | | public override ulong SetBoundsInt(int rowIdentifier, int columnIdentifier, BoundsInt newValue) |
| | 0 | 1004 | | { |
| | 0 | 1005 | | return SetCell(rowIdentifier, columnIdentifier, ref AllBoundsIntColumns, newValue); |
| | 0 | 1006 | | } |
| | | 1007 | | |
| | | 1008 | | /// <inheritdoc /> |
| | | 1009 | | public override ulong SetHash128(int rowIdentifier, int columnIdentifier, Hash128 newValue) |
| | 0 | 1010 | | { |
| | 0 | 1011 | | return SetCell(rowIdentifier, columnIdentifier, ref AllHash128Columns, newValue); |
| | 0 | 1012 | | } |
| | | 1013 | | |
| | | 1014 | | /// <inheritdoc /> |
| | | 1015 | | public override ulong SetGradient(int rowIdentifier, int columnIdentifier, Gradient newValue) |
| | 0 | 1016 | | { |
| | 0 | 1017 | | return SetCell(rowIdentifier, columnIdentifier, ref AllGradientColumns, newValue); |
| | 0 | 1018 | | } |
| | | 1019 | | |
| | | 1020 | | /// <inheritdoc /> |
| | | 1021 | | public override ulong SetAnimationCurve(int rowIdentifier, int columnIdentifier, AnimationCurve newValue) |
| | 0 | 1022 | | { |
| | 0 | 1023 | | return SetCell(rowIdentifier, columnIdentifier, ref AllAnimationCurveColumns, newValue); |
| | 0 | 1024 | | } |
| | | 1025 | | |
| | | 1026 | | /// <inheritdoc /> |
| | | 1027 | | public override ulong SetObject(int rowIdentifier, int columnIdentifier, Object newValue) |
| | 0 | 1028 | | { |
| | 0 | 1029 | | return SetCell(rowIdentifier, columnIdentifier, ref AllObjectRefColumns, newValue); |
| | 0 | 1030 | | } |
| | | 1031 | | |
| | | 1032 | | /// <inheritdoc /> |
| | | 1033 | | public override void SetTypeNameForObjectColumn(int columnIdentifier, string assemblyQualifiedName) |
| | 0 | 1034 | | { |
| | 0 | 1035 | | AssertObjectColumnIDValid(columnIdentifier); |
| | 0 | 1036 | | int denseIndex = ColumnIDToDenseIndexMap[columnIdentifier].ColumnDenseIndex; |
| | 0 | 1037 | | AllObjectRefTypeNames[denseIndex] = assemblyQualifiedName; |
| | 0 | 1038 | | } |
| | | 1039 | | |
| | | 1040 | | /// <inheritdoc /> |
| | | 1041 | | public override string GetTypeNameForObjectColumn(int columnIdentifier) |
| | 0 | 1042 | | { |
| | 0 | 1043 | | AssertObjectColumnIDValid(columnIdentifier); |
| | 0 | 1044 | | int denseIndex = ColumnIDToDenseIndexMap[columnIdentifier].ColumnDenseIndex; |
| | 0 | 1045 | | return AllObjectRefTypeNames[denseIndex]; |
| | 0 | 1046 | | } |
| | | 1047 | | |
| | | 1048 | | // Get |
| | | 1049 | | /// <inheritdoc /> |
| | | 1050 | | public override string GetString(int rowIdentifier, int columnIdentifier) |
| | 0 | 1051 | | { |
| | 0 | 1052 | | return GetCell(rowIdentifier, columnIdentifier, ref AllStringColumns); |
| | 0 | 1053 | | } |
| | | 1054 | | |
| | | 1055 | | /// <inheritdoc /> |
| | | 1056 | | public override bool GetBool(int rowIdentifier, int columnIdentifier) |
| | 0 | 1057 | | { |
| | 0 | 1058 | | return GetCell(rowIdentifier, columnIdentifier, ref AllBoolColumns); |
| | 0 | 1059 | | } |
| | | 1060 | | |
| | | 1061 | | /// <inheritdoc /> |
| | | 1062 | | public override char GetChar(int rowIdentifier, int columnIdentifier) |
| | 0 | 1063 | | { |
| | 0 | 1064 | | return GetCell(rowIdentifier, columnIdentifier, ref AllCharColumns); |
| | 0 | 1065 | | } |
| | | 1066 | | |
| | | 1067 | | /// <inheritdoc /> |
| | | 1068 | | public override sbyte GetSByte(int rowIdentifier, int columnIdentifier) |
| | 0 | 1069 | | { |
| | 0 | 1070 | | return GetCell(rowIdentifier, columnIdentifier, ref AllSbyteColumns); |
| | 0 | 1071 | | } |
| | | 1072 | | |
| | | 1073 | | /// <inheritdoc /> |
| | | 1074 | | public override byte GetByte(int rowIdentifier, int columnIdentifier) |
| | 0 | 1075 | | { |
| | 0 | 1076 | | return GetCell(rowIdentifier, columnIdentifier, ref AllByteColumns); |
| | 0 | 1077 | | } |
| | | 1078 | | |
| | | 1079 | | /// <inheritdoc /> |
| | | 1080 | | public override short GetShort(int rowIdentifier, int columnIdentifier) |
| | 0 | 1081 | | { |
| | 0 | 1082 | | return GetCell(rowIdentifier, columnIdentifier, ref AllShortColumns); |
| | 0 | 1083 | | } |
| | | 1084 | | |
| | | 1085 | | /// <inheritdoc /> |
| | | 1086 | | public override ushort GetUShort(int rowIdentifier, int columnIdentifier) |
| | 0 | 1087 | | { |
| | 0 | 1088 | | return GetCell(rowIdentifier, columnIdentifier, ref AllUshortColumns); |
| | 0 | 1089 | | } |
| | | 1090 | | |
| | | 1091 | | /// <inheritdoc /> |
| | | 1092 | | public override int GetInt(int rowIdentifier, int columnIdentifier) |
| | 0 | 1093 | | { |
| | 0 | 1094 | | return GetCell(rowIdentifier, columnIdentifier, ref AllIntColumns); |
| | 0 | 1095 | | } |
| | | 1096 | | |
| | | 1097 | | /// <inheritdoc /> |
| | | 1098 | | public override uint GetUInt(int rowIdentifier, int columnIdentifier) |
| | 0 | 1099 | | { |
| | 0 | 1100 | | return GetCell(rowIdentifier, columnIdentifier, ref AllUintColumns); |
| | 0 | 1101 | | } |
| | | 1102 | | |
| | | 1103 | | /// <inheritdoc /> |
| | | 1104 | | public override long GetLong(int rowIdentifier, int columnIdentifier) |
| | 0 | 1105 | | { |
| | 0 | 1106 | | return GetCell(rowIdentifier, columnIdentifier, ref AllLongColumns); |
| | 0 | 1107 | | } |
| | | 1108 | | |
| | | 1109 | | /// <inheritdoc /> |
| | | 1110 | | public override ulong GetULong(int rowIdentifier, int columnIdentifier) |
| | 0 | 1111 | | { |
| | 0 | 1112 | | return GetCell(rowIdentifier, columnIdentifier, ref AllUlongColumns); |
| | 0 | 1113 | | } |
| | | 1114 | | |
| | | 1115 | | /// <inheritdoc /> |
| | | 1116 | | public override float GetFloat(int rowIdentifier, int columnIdentifier) |
| | 0 | 1117 | | { |
| | 0 | 1118 | | return GetCell(rowIdentifier, columnIdentifier, ref AllFloatColumns); |
| | 0 | 1119 | | } |
| | | 1120 | | |
| | | 1121 | | /// <inheritdoc /> |
| | | 1122 | | public override double GetDouble(int rowIdentifier, int columnIdentifier) |
| | 0 | 1123 | | { |
| | 0 | 1124 | | return GetCell(rowIdentifier, columnIdentifier, ref AllDoubleColumns); |
| | 0 | 1125 | | } |
| | | 1126 | | |
| | | 1127 | | /// <inheritdoc /> |
| | | 1128 | | public override Vector2 GetVector2(int rowIdentifier, int columnIdentifier) |
| | 0 | 1129 | | { |
| | 0 | 1130 | | return GetCell(rowIdentifier, columnIdentifier, ref AllVector2Columns); |
| | 0 | 1131 | | } |
| | | 1132 | | |
| | | 1133 | | /// <inheritdoc /> |
| | | 1134 | | public override Vector3 GetVector3(int rowIdentifier, int columnIdentifier) |
| | 0 | 1135 | | { |
| | 0 | 1136 | | return GetCell(rowIdentifier, columnIdentifier, ref AllVector3Columns); |
| | 0 | 1137 | | } |
| | | 1138 | | |
| | | 1139 | | /// <inheritdoc /> |
| | | 1140 | | public override Vector4 GetVector4(int rowIdentifier, int columnIdentifier) |
| | 0 | 1141 | | { |
| | 0 | 1142 | | return GetCell(rowIdentifier, columnIdentifier, ref AllVector4Columns); |
| | 0 | 1143 | | } |
| | | 1144 | | |
| | | 1145 | | /// <inheritdoc /> |
| | | 1146 | | public override Vector2Int GetVector2Int(int rowIdentifier, int columnIdentifier) |
| | 0 | 1147 | | { |
| | 0 | 1148 | | return GetCell(rowIdentifier, columnIdentifier, ref AllVector2IntColumns); |
| | 0 | 1149 | | } |
| | | 1150 | | |
| | | 1151 | | /// <inheritdoc /> |
| | | 1152 | | public override Vector3Int GetVector3Int(int rowIdentifier, int columnIdentifier) |
| | 0 | 1153 | | { |
| | 0 | 1154 | | return GetCell(rowIdentifier, columnIdentifier, ref AllVector3IntColumns); |
| | 0 | 1155 | | } |
| | | 1156 | | |
| | | 1157 | | /// <inheritdoc /> |
| | | 1158 | | public override Quaternion GetQuaternion(int rowIdentifier, int columnIdentifier) |
| | 0 | 1159 | | { |
| | 0 | 1160 | | return GetCell(rowIdentifier, columnIdentifier, ref AllQuaternionColumns); |
| | 0 | 1161 | | } |
| | | 1162 | | |
| | | 1163 | | /// <inheritdoc /> |
| | | 1164 | | public override Rect GetRect(int rowIdentifier, int columnIdentifier) |
| | 0 | 1165 | | { |
| | 0 | 1166 | | return GetCell(rowIdentifier, columnIdentifier, ref AllRectColumns); |
| | 0 | 1167 | | } |
| | | 1168 | | |
| | | 1169 | | /// <inheritdoc /> |
| | | 1170 | | public override RectInt GetRectInt(int rowIdentifier, int columnIdentifier) |
| | 0 | 1171 | | { |
| | 0 | 1172 | | return GetCell(rowIdentifier, columnIdentifier, ref AllRectIntColumns); |
| | 0 | 1173 | | } |
| | | 1174 | | |
| | | 1175 | | /// <inheritdoc /> |
| | | 1176 | | public override Color GetColor(int rowIdentifier, int columnIdentifier) |
| | 0 | 1177 | | { |
| | 0 | 1178 | | return GetCell(rowIdentifier, columnIdentifier, ref AllColorColumns); |
| | 0 | 1179 | | } |
| | | 1180 | | |
| | | 1181 | | /// <inheritdoc /> |
| | | 1182 | | public override LayerMask GetLayerMask(int rowIdentifier, int columnIdentifier) |
| | 0 | 1183 | | { |
| | 0 | 1184 | | return GetCell(rowIdentifier, columnIdentifier, ref AllLayerMaskColumns); |
| | 0 | 1185 | | } |
| | | 1186 | | |
| | | 1187 | | /// <inheritdoc /> |
| | | 1188 | | public override Bounds GetBounds(int rowIdentifier, int columnIdentifier) |
| | 0 | 1189 | | { |
| | 0 | 1190 | | return GetCell(rowIdentifier, columnIdentifier, ref AllBoundsColumns); |
| | 0 | 1191 | | } |
| | | 1192 | | |
| | | 1193 | | /// <inheritdoc /> |
| | | 1194 | | public override BoundsInt GetBoundsInt(int rowIdentifier, int columnIdentifier) |
| | 0 | 1195 | | { |
| | 0 | 1196 | | return GetCell(rowIdentifier, columnIdentifier, ref AllBoundsIntColumns); |
| | 0 | 1197 | | } |
| | | 1198 | | |
| | | 1199 | | /// <inheritdoc /> |
| | | 1200 | | public override Hash128 GetHash128(int rowIdentifier, int columnIdentifier) |
| | 0 | 1201 | | { |
| | 0 | 1202 | | return GetCell(rowIdentifier, columnIdentifier, ref AllHash128Columns); |
| | 0 | 1203 | | } |
| | | 1204 | | |
| | | 1205 | | /// <inheritdoc /> |
| | | 1206 | | public override Gradient GetGradient(int rowIdentifier, int columnIdentifier) |
| | 0 | 1207 | | { |
| | 0 | 1208 | | return GetCell(rowIdentifier, columnIdentifier, ref AllGradientColumns); |
| | 0 | 1209 | | } |
| | | 1210 | | |
| | | 1211 | | /// <inheritdoc /> |
| | | 1212 | | public override AnimationCurve GetAnimationCurve(int rowIdentifier, int columnIdentifier) |
| | 0 | 1213 | | { |
| | 0 | 1214 | | return GetCell(rowIdentifier, columnIdentifier, ref AllAnimationCurveColumns); |
| | 0 | 1215 | | } |
| | | 1216 | | |
| | | 1217 | | /// <inheritdoc /> |
| | | 1218 | | public override Object GetObject(int rowIdentifier, int columnIdentifier) |
| | 0 | 1219 | | { |
| | 0 | 1220 | | return GetCell(rowIdentifier, columnIdentifier, ref AllObjectRefColumns); |
| | 0 | 1221 | | } |
| | | 1222 | | |
| | | 1223 | | // Get ref |
| | | 1224 | | |
| | | 1225 | | public ref string GetStringRef(int row, int column) |
| | 0 | 1226 | | { |
| | 0 | 1227 | | return ref GetCellRef(row, column, ref AllStringColumns); |
| | 0 | 1228 | | } |
| | | 1229 | | |
| | | 1230 | | public ref bool GetBoolRef(int row, int column) |
| | 0 | 1231 | | { |
| | 0 | 1232 | | return ref GetCellRef(row, column, ref AllBoolColumns); |
| | 0 | 1233 | | } |
| | | 1234 | | |
| | | 1235 | | public ref char GetCharRef(int row, int column) |
| | 0 | 1236 | | { |
| | 0 | 1237 | | return ref GetCellRef(row, column, ref AllCharColumns); |
| | 0 | 1238 | | } |
| | | 1239 | | |
| | | 1240 | | public ref sbyte GetSbyteRef(int row, int column) |
| | 0 | 1241 | | { |
| | 0 | 1242 | | return ref GetCellRef(row, column, ref AllSbyteColumns); |
| | 0 | 1243 | | } |
| | | 1244 | | |
| | | 1245 | | public ref byte GetByteRef(int row, int columnID) |
| | 0 | 1246 | | { |
| | 0 | 1247 | | return ref GetCellRef(row, columnID, ref AllByteColumns); |
| | 0 | 1248 | | } |
| | | 1249 | | |
| | | 1250 | | public ref short GetShortRef(int row, int column) |
| | 0 | 1251 | | { |
| | 0 | 1252 | | return ref GetCellRef(row, column, ref AllShortColumns); |
| | 0 | 1253 | | } |
| | | 1254 | | |
| | | 1255 | | public ref ushort GetUshortRef(int row, int column) |
| | 0 | 1256 | | { |
| | 0 | 1257 | | return ref GetCellRef(row, column, ref AllUshortColumns); |
| | 0 | 1258 | | } |
| | | 1259 | | |
| | | 1260 | | public ref int GetIntRef(int row, int column) |
| | 0 | 1261 | | { |
| | 0 | 1262 | | return ref GetCellRef(row, column, ref AllIntColumns); |
| | 0 | 1263 | | } |
| | | 1264 | | |
| | | 1265 | | public ref uint GetUintRef(int row, int column) |
| | 0 | 1266 | | { |
| | 0 | 1267 | | return ref GetCellRef(row, column, ref AllUintColumns); |
| | 0 | 1268 | | } |
| | | 1269 | | |
| | | 1270 | | public ref long GetLongRef(int row, int column) |
| | 0 | 1271 | | { |
| | 0 | 1272 | | return ref GetCellRef(row, column, ref AllLongColumns); |
| | 0 | 1273 | | } |
| | | 1274 | | |
| | | 1275 | | public ref ulong GetUlongRef(int row, int column) |
| | 0 | 1276 | | { |
| | 0 | 1277 | | return ref GetCellRef(row, column, ref AllUlongColumns); |
| | 0 | 1278 | | } |
| | | 1279 | | |
| | | 1280 | | public ref float GetFloatRef(int row, int column) |
| | 0 | 1281 | | { |
| | 0 | 1282 | | return ref GetCellRef(row, column, ref AllFloatColumns); |
| | 0 | 1283 | | } |
| | | 1284 | | |
| | | 1285 | | public ref double GetDoubleRef(int row, int column) |
| | 0 | 1286 | | { |
| | 0 | 1287 | | return ref GetCellRef(row, column, ref AllDoubleColumns); |
| | 0 | 1288 | | } |
| | | 1289 | | |
| | | 1290 | | public ref Vector2 GetVector2Ref(int row, int column) |
| | 0 | 1291 | | { |
| | 0 | 1292 | | return ref GetCellRef(row, column, ref AllVector2Columns); |
| | 0 | 1293 | | } |
| | | 1294 | | |
| | | 1295 | | public ref Vector3 GetVector3Ref(int row, int column) |
| | 0 | 1296 | | { |
| | 0 | 1297 | | return ref GetCellRef(row, column, ref AllVector3Columns); |
| | 0 | 1298 | | } |
| | | 1299 | | |
| | | 1300 | | public ref Vector4 GetVector4Ref(int row, int column) |
| | 0 | 1301 | | { |
| | 0 | 1302 | | return ref GetCellRef(row, column, ref AllVector4Columns); |
| | 0 | 1303 | | } |
| | | 1304 | | |
| | | 1305 | | public ref Vector2Int GetVector2IntRef(int row, int column) |
| | 0 | 1306 | | { |
| | 0 | 1307 | | return ref GetCellRef(row, column, ref AllVector2IntColumns); |
| | 0 | 1308 | | } |
| | | 1309 | | |
| | | 1310 | | public ref Vector3Int GetVector3IntRef(int row, int column) |
| | 0 | 1311 | | { |
| | 0 | 1312 | | return ref GetCellRef(row, column, ref AllVector3IntColumns); |
| | 0 | 1313 | | } |
| | | 1314 | | |
| | | 1315 | | public ref Quaternion GetQuaternionRef(int row, int column) |
| | 0 | 1316 | | { |
| | 0 | 1317 | | return ref GetCellRef(row, column, ref AllQuaternionColumns); |
| | 0 | 1318 | | } |
| | | 1319 | | |
| | | 1320 | | public ref Rect GetRectRef(int row, int column) |
| | 0 | 1321 | | { |
| | 0 | 1322 | | return ref GetCellRef(row, column, ref AllRectColumns); |
| | 0 | 1323 | | } |
| | | 1324 | | |
| | | 1325 | | public ref RectInt GetRectIntRef(int row, int column) |
| | 0 | 1326 | | { |
| | 0 | 1327 | | return ref GetCellRef(row, column, ref AllRectIntColumns); |
| | 0 | 1328 | | } |
| | | 1329 | | |
| | | 1330 | | public ref Color GetColorRef(int row, int column) |
| | 0 | 1331 | | { |
| | 0 | 1332 | | return ref GetCellRef(row, column, ref AllColorColumns); |
| | 0 | 1333 | | } |
| | | 1334 | | |
| | | 1335 | | public ref LayerMask GetLayerMaskRef(int row, int column) |
| | 0 | 1336 | | { |
| | 0 | 1337 | | return ref GetCellRef(row, column, ref AllLayerMaskColumns); |
| | 0 | 1338 | | } |
| | | 1339 | | |
| | | 1340 | | public ref Bounds GetBoundsRef(int row, int column) |
| | 0 | 1341 | | { |
| | 0 | 1342 | | return ref GetCellRef(row, column, ref AllBoundsColumns); |
| | 0 | 1343 | | } |
| | | 1344 | | |
| | | 1345 | | public ref BoundsInt GetBoundsIntRef(int row, int column) |
| | 0 | 1346 | | { |
| | 0 | 1347 | | return ref GetCellRef(row, column, ref AllBoundsIntColumns); |
| | 0 | 1348 | | } |
| | | 1349 | | |
| | | 1350 | | public ref Hash128 GetHash128Ref(int row, int column) |
| | 0 | 1351 | | { |
| | 0 | 1352 | | return ref GetCellRef(row, column, ref AllHash128Columns); |
| | 0 | 1353 | | } |
| | | 1354 | | |
| | | 1355 | | public ref Gradient GetGradientRef(int row, int column) |
| | 0 | 1356 | | { |
| | 0 | 1357 | | return ref GetCellRef(row, column, ref AllGradientColumns); |
| | 0 | 1358 | | } |
| | | 1359 | | |
| | | 1360 | | public ref AnimationCurve GetAnimationCurveRef(int row, int column) |
| | 0 | 1361 | | { |
| | 0 | 1362 | | return ref GetCellRef(row, column, ref AllAnimationCurveColumns); |
| | 0 | 1363 | | } |
| | | 1364 | | |
| | | 1365 | | public ref Object GetObjectRef(int row, int column) |
| | 0 | 1366 | | { |
| | 0 | 1367 | | return ref GetCellRef(row, column, ref AllObjectRefColumns); |
| | 0 | 1368 | | } |
| | | 1369 | | |
| | | 1370 | | // Get Column |
| | | 1371 | | |
| | | 1372 | | public string[] GetStringColumn(int column) |
| | 0 | 1373 | | { |
| | 0 | 1374 | | return GetColumn(column, ref AllStringColumns); |
| | 0 | 1375 | | } |
| | | 1376 | | |
| | | 1377 | | public bool[] GetBoolColumn(int column) |
| | 0 | 1378 | | { |
| | 0 | 1379 | | return GetColumn(column, ref AllBoolColumns); |
| | 0 | 1380 | | } |
| | | 1381 | | |
| | | 1382 | | public char[] GetCharColumn(int column) |
| | 0 | 1383 | | { |
| | 0 | 1384 | | return GetColumn(column, ref AllCharColumns); |
| | 0 | 1385 | | } |
| | | 1386 | | |
| | | 1387 | | public sbyte[] GetSbyteColumn(int column) |
| | 0 | 1388 | | { |
| | 0 | 1389 | | return GetColumn(column, ref AllSbyteColumns); |
| | 0 | 1390 | | } |
| | | 1391 | | |
| | | 1392 | | public byte[] GetByteColumn(int column) |
| | 0 | 1393 | | { |
| | 0 | 1394 | | return GetColumn(column, ref AllByteColumns); |
| | 0 | 1395 | | } |
| | | 1396 | | |
| | | 1397 | | public short[] GetShortColumn(int column) |
| | 0 | 1398 | | { |
| | 0 | 1399 | | return GetColumn(column, ref AllShortColumns); |
| | 0 | 1400 | | } |
| | | 1401 | | |
| | | 1402 | | public ushort[] GetUshortColumn(int column) |
| | 0 | 1403 | | { |
| | 0 | 1404 | | return GetColumn(column, ref AllUshortColumns); |
| | 0 | 1405 | | } |
| | | 1406 | | |
| | | 1407 | | public int[] GetIntColumn(int column) |
| | 0 | 1408 | | { |
| | 0 | 1409 | | return GetColumn(column, ref AllIntColumns); |
| | 0 | 1410 | | } |
| | | 1411 | | |
| | | 1412 | | public uint[] GetUintColumn(int column) |
| | 0 | 1413 | | { |
| | 0 | 1414 | | return GetColumn(column, ref AllUintColumns); |
| | 0 | 1415 | | } |
| | | 1416 | | |
| | | 1417 | | public long[] GetLongColumn(int column) |
| | 0 | 1418 | | { |
| | 0 | 1419 | | return GetColumn(column, ref AllLongColumns); |
| | 0 | 1420 | | } |
| | | 1421 | | |
| | | 1422 | | public ulong[] GetUlongColumn(int column) |
| | 0 | 1423 | | { |
| | 0 | 1424 | | return GetColumn(column, ref AllUlongColumns); |
| | 0 | 1425 | | } |
| | | 1426 | | |
| | | 1427 | | public float[] GetFloatColumn(int column) |
| | 0 | 1428 | | { |
| | 0 | 1429 | | return GetColumn(column, ref AllFloatColumns); |
| | 0 | 1430 | | } |
| | | 1431 | | |
| | | 1432 | | public double[] GetDoubleColumn(int column) |
| | 0 | 1433 | | { |
| | 0 | 1434 | | return GetColumn(column, ref AllDoubleColumns); |
| | 0 | 1435 | | } |
| | | 1436 | | |
| | | 1437 | | public Vector2[] GetVector2Column(int column) |
| | 0 | 1438 | | { |
| | 0 | 1439 | | return GetColumn(column, ref AllVector2Columns); |
| | 0 | 1440 | | } |
| | | 1441 | | |
| | | 1442 | | public Vector3[] GetVector3Column(int column) |
| | 0 | 1443 | | { |
| | 0 | 1444 | | return GetColumn(column, ref AllVector3Columns); |
| | 0 | 1445 | | } |
| | | 1446 | | |
| | | 1447 | | public Vector4[] GetVector4Column(int column) |
| | 0 | 1448 | | { |
| | 0 | 1449 | | return GetColumn(column, ref AllVector4Columns); |
| | 0 | 1450 | | } |
| | | 1451 | | |
| | | 1452 | | public Vector2Int[] GetVector2IntColumn(int column) |
| | 0 | 1453 | | { |
| | 0 | 1454 | | return GetColumn(column, ref AllVector2IntColumns); |
| | 0 | 1455 | | } |
| | | 1456 | | |
| | | 1457 | | public Vector3Int[] GetVector3IntColumn(int column) |
| | 0 | 1458 | | { |
| | 0 | 1459 | | return GetColumn(column, ref AllVector3IntColumns); |
| | 0 | 1460 | | } |
| | | 1461 | | |
| | | 1462 | | public Quaternion[] GetQuaternionColumn(int column) |
| | 0 | 1463 | | { |
| | 0 | 1464 | | return GetColumn(column, ref AllQuaternionColumns); |
| | 0 | 1465 | | } |
| | | 1466 | | |
| | | 1467 | | public Rect[] GetRectColumn(int column) |
| | 0 | 1468 | | { |
| | 0 | 1469 | | return GetColumn(column, ref AllRectColumns); |
| | 0 | 1470 | | } |
| | | 1471 | | |
| | | 1472 | | public RectInt[] GetRectIntColumn(int column) |
| | 0 | 1473 | | { |
| | 0 | 1474 | | return GetColumn(column, ref AllRectIntColumns); |
| | 0 | 1475 | | } |
| | | 1476 | | |
| | | 1477 | | public Color[] GetColorColumn(int column) |
| | 0 | 1478 | | { |
| | 0 | 1479 | | return GetColumn(column, ref AllColorColumns); |
| | 0 | 1480 | | } |
| | | 1481 | | |
| | | 1482 | | public LayerMask[] GetLayerMaskColumn(int column) |
| | 0 | 1483 | | { |
| | 0 | 1484 | | return GetColumn(column, ref AllLayerMaskColumns); |
| | 0 | 1485 | | } |
| | | 1486 | | |
| | | 1487 | | public Bounds[] GetBoundsColumn(int column) |
| | 0 | 1488 | | { |
| | 0 | 1489 | | return GetColumn(column, ref AllBoundsColumns); |
| | 0 | 1490 | | } |
| | | 1491 | | |
| | | 1492 | | public BoundsInt[] GetBoundsIntColumn(int column) |
| | 0 | 1493 | | { |
| | 0 | 1494 | | return GetColumn(column, ref AllBoundsIntColumns); |
| | 0 | 1495 | | } |
| | | 1496 | | |
| | | 1497 | | public Hash128[] GetHash128Column(int column) |
| | 0 | 1498 | | { |
| | 0 | 1499 | | return GetColumn(column, ref AllHash128Columns); |
| | 0 | 1500 | | } |
| | | 1501 | | |
| | | 1502 | | public Gradient[] GetGradientColumn(int column) |
| | 0 | 1503 | | { |
| | 0 | 1504 | | return GetColumn(column, ref AllGradientColumns); |
| | 0 | 1505 | | } |
| | | 1506 | | |
| | | 1507 | | public AnimationCurve[] GetAnimationCurveColumn(int column) |
| | 0 | 1508 | | { |
| | 0 | 1509 | | return GetColumn(column, ref AllAnimationCurveColumns); |
| | 0 | 1510 | | } |
| | | 1511 | | |
| | | 1512 | | public Object[] GetObjectColumn(int column) |
| | 0 | 1513 | | { |
| | 0 | 1514 | | return GetColumn(column, ref AllObjectRefColumns); |
| | 0 | 1515 | | } |
| | | 1516 | | |
| | | 1517 | | // SetOrder |
| | | 1518 | | |
| | | 1519 | | public void SetColumnOrder(int columnID, int newSortOrder) |
| | 0 | 1520 | | { |
| | 0 | 1521 | | AssertColumnIDValid(columnID); |
| | 0 | 1522 | | AssertColumnSortOrderValid(newSortOrder); |
| | 0 | 1523 | | int oldSortOrder = ColumnIDToSortOrderMap[columnID]; |
| | 0 | 1524 | | int iterDirection = newSortOrder > oldSortOrder ? 1 : -1; |
| | 0 | 1525 | | for (int i = oldSortOrder; i != newSortOrder; i += iterDirection) |
| | 0 | 1526 | | { |
| | 0 | 1527 | | int columnIDAt = SortedOrderToColumnIDMap[i + iterDirection]; |
| | 0 | 1528 | | ColumnIDToSortOrderMap[columnIDAt] = i; |
| | 0 | 1529 | | SortedOrderToColumnIDMap[i] = SortedOrderToColumnIDMap[i + iterDirection]; |
| | 0 | 1530 | | } |
| | | 1531 | | |
| | 0 | 1532 | | SortedOrderToColumnIDMap[newSortOrder] = columnID; |
| | 0 | 1533 | | ColumnIDToSortOrderMap[columnID] = newSortOrder; |
| | 0 | 1534 | | } |
| | | 1535 | | |
| | | 1536 | | public void SetAllColumnOrders(int[] sortedColumnIDs) |
| | 0 | 1537 | | { |
| | 0 | 1538 | | AssertSortedColumnsArgValid(sortedColumnIDs); |
| | 0 | 1539 | | for (int i = 0; i < SortedOrderToColumnIDMap.Length; i++) |
| | 0 | 1540 | | { |
| | 0 | 1541 | | int columnID = sortedColumnIDs[i]; |
| | 0 | 1542 | | SortedOrderToColumnIDMap[i] = columnID; |
| | 0 | 1543 | | ColumnIDToSortOrderMap[columnID] = i; |
| | 0 | 1544 | | } |
| | 0 | 1545 | | } |
| | | 1546 | | |
| | | 1547 | | public void SetRowOrder(int rowID, int newSortOrder) |
| | 0 | 1548 | | { |
| | 0 | 1549 | | AssertRowIDValid(rowID); |
| | 0 | 1550 | | AssertRowSortOrderValid(newSortOrder); |
| | | 1551 | | |
| | 0 | 1552 | | int oldSortOrder = RowIDToDenseIndexMap[rowID]; |
| | 0 | 1553 | | int iterDirection = newSortOrder > oldSortOrder ? 1 : -1; |
| | | 1554 | | |
| | 0 | 1555 | | for (int i = oldSortOrder; i != newSortOrder; i += iterDirection) |
| | 0 | 1556 | | { |
| | 0 | 1557 | | int rowIDAt = RowDenseIndexToIDMap[i + iterDirection]; |
| | 0 | 1558 | | RowIDToDenseIndexMap[rowIDAt] = i; |
| | 0 | 1559 | | RowDenseIndexToIDMap[i] = RowDenseIndexToIDMap[i + iterDirection]; |
| | 0 | 1560 | | } |
| | | 1561 | | |
| | 0 | 1562 | | SetRowOrderForColumns(AllStringColumns, oldSortOrder, newSortOrder); |
| | 0 | 1563 | | SetRowOrderForColumns(AllBoolColumns, oldSortOrder, newSortOrder); |
| | 0 | 1564 | | SetRowOrderForColumns(AllCharColumns, oldSortOrder, newSortOrder); |
| | 0 | 1565 | | SetRowOrderForColumns(AllSbyteColumns, oldSortOrder, newSortOrder); |
| | 0 | 1566 | | SetRowOrderForColumns(AllByteColumns, oldSortOrder, newSortOrder); |
| | 0 | 1567 | | SetRowOrderForColumns(AllShortColumns, oldSortOrder, newSortOrder); |
| | 0 | 1568 | | SetRowOrderForColumns(AllUshortColumns, oldSortOrder, newSortOrder); |
| | 0 | 1569 | | SetRowOrderForColumns(AllIntColumns, oldSortOrder, newSortOrder); |
| | 0 | 1570 | | SetRowOrderForColumns(AllUintColumns, oldSortOrder, newSortOrder); |
| | 0 | 1571 | | SetRowOrderForColumns(AllLongColumns, oldSortOrder, newSortOrder); |
| | 0 | 1572 | | SetRowOrderForColumns(AllUlongColumns, oldSortOrder, newSortOrder); |
| | 0 | 1573 | | SetRowOrderForColumns(AllFloatColumns, oldSortOrder, newSortOrder); |
| | 0 | 1574 | | SetRowOrderForColumns(AllDoubleColumns, oldSortOrder, newSortOrder); |
| | 0 | 1575 | | SetRowOrderForColumns(AllVector2Columns, oldSortOrder, newSortOrder); |
| | 0 | 1576 | | SetRowOrderForColumns(AllVector3Columns, oldSortOrder, newSortOrder); |
| | 0 | 1577 | | SetRowOrderForColumns(AllVector4Columns, oldSortOrder, newSortOrder); |
| | 0 | 1578 | | SetRowOrderForColumns(AllVector2IntColumns, oldSortOrder, newSortOrder); |
| | 0 | 1579 | | SetRowOrderForColumns(AllVector3IntColumns, oldSortOrder, newSortOrder); |
| | 0 | 1580 | | SetRowOrderForColumns(AllQuaternionColumns, oldSortOrder, newSortOrder); |
| | 0 | 1581 | | SetRowOrderForColumns(AllRectColumns, oldSortOrder, newSortOrder); |
| | 0 | 1582 | | SetRowOrderForColumns(AllRectIntColumns, oldSortOrder, newSortOrder); |
| | 0 | 1583 | | SetRowOrderForColumns(AllColorColumns, oldSortOrder, newSortOrder); |
| | 0 | 1584 | | SetRowOrderForColumns(AllLayerMaskColumns, oldSortOrder, newSortOrder); |
| | 0 | 1585 | | SetRowOrderForColumns(AllBoundsColumns, oldSortOrder, newSortOrder); |
| | 0 | 1586 | | SetRowOrderForColumns(AllBoundsIntColumns, oldSortOrder, newSortOrder); |
| | 0 | 1587 | | SetRowOrderForColumns(AllHash128Columns, oldSortOrder, newSortOrder); |
| | 0 | 1588 | | SetRowOrderForColumns(AllGradientColumns, oldSortOrder, newSortOrder); |
| | 0 | 1589 | | SetRowOrderForColumns(AllAnimationCurveColumns, oldSortOrder, newSortOrder); |
| | 0 | 1590 | | SetRowOrderForColumns(AllObjectRefColumns, oldSortOrder, newSortOrder); |
| | 0 | 1591 | | } |
| | | 1592 | | |
| | | 1593 | | public void SetAllRowOrders(int[] sortedRowIDs) |
| | 0 | 1594 | | { |
| | 0 | 1595 | | AssertSortRowsArgValid(sortedRowIDs); |
| | | 1596 | | |
| | 0 | 1597 | | ReSortRows(AllStringColumns, sortedRowIDs); |
| | 0 | 1598 | | ReSortRows(AllBoolColumns, sortedRowIDs); |
| | 0 | 1599 | | ReSortRows(AllCharColumns, sortedRowIDs); |
| | 0 | 1600 | | ReSortRows(AllSbyteColumns, sortedRowIDs); |
| | 0 | 1601 | | ReSortRows(AllByteColumns, sortedRowIDs); |
| | 0 | 1602 | | ReSortRows(AllShortColumns, sortedRowIDs); |
| | 0 | 1603 | | ReSortRows(AllUshortColumns, sortedRowIDs); |
| | 0 | 1604 | | ReSortRows(AllIntColumns, sortedRowIDs); |
| | 0 | 1605 | | ReSortRows(AllUintColumns, sortedRowIDs); |
| | 0 | 1606 | | ReSortRows(AllLongColumns, sortedRowIDs); |
| | 0 | 1607 | | ReSortRows(AllUlongColumns, sortedRowIDs); |
| | 0 | 1608 | | ReSortRows(AllFloatColumns, sortedRowIDs); |
| | 0 | 1609 | | ReSortRows(AllDoubleColumns, sortedRowIDs); |
| | 0 | 1610 | | ReSortRows(AllVector2Columns, sortedRowIDs); |
| | 0 | 1611 | | ReSortRows(AllVector3Columns, sortedRowIDs); |
| | 0 | 1612 | | ReSortRows(AllVector4Columns, sortedRowIDs); |
| | 0 | 1613 | | ReSortRows(AllVector2IntColumns, sortedRowIDs); |
| | 0 | 1614 | | ReSortRows(AllVector3IntColumns, sortedRowIDs); |
| | 0 | 1615 | | ReSortRows(AllQuaternionColumns, sortedRowIDs); |
| | 0 | 1616 | | ReSortRows(AllRectColumns, sortedRowIDs); |
| | 0 | 1617 | | ReSortRows(AllRectIntColumns, sortedRowIDs); |
| | 0 | 1618 | | ReSortRows(AllColorColumns, sortedRowIDs); |
| | 0 | 1619 | | ReSortRows(AllLayerMaskColumns, sortedRowIDs); |
| | 0 | 1620 | | ReSortRows(AllBoundsColumns, sortedRowIDs); |
| | 0 | 1621 | | ReSortRows(AllBoundsIntColumns, sortedRowIDs); |
| | 0 | 1622 | | ReSortRows(AllHash128Columns, sortedRowIDs); |
| | 0 | 1623 | | ReSortRows(AllGradientColumns, sortedRowIDs); |
| | 0 | 1624 | | ReSortRows(AllAnimationCurveColumns, sortedRowIDs); |
| | 0 | 1625 | | ReSortRows(AllObjectRefColumns, sortedRowIDs); |
| | | 1626 | | |
| | 0 | 1627 | | for (int i = 0; i < sortedRowIDs.Length; i++) |
| | 0 | 1628 | | { |
| | 0 | 1629 | | int rowID = sortedRowIDs[i]; |
| | 0 | 1630 | | RowDenseIndexToIDMap[i] = rowID; |
| | 0 | 1631 | | RowIDToDenseIndexMap[rowID] = i; |
| | 0 | 1632 | | } |
| | 0 | 1633 | | } |
| | | 1634 | | |
| | | 1635 | | internal void ReSortRows<T>(ArrayHolder<T>[] columns, int[] sortedRowIDs) |
| | 0 | 1636 | | { |
| | 0 | 1637 | | int columnCount = columns?.Length ?? 0; |
| | 0 | 1638 | | for (int i = 0; i < columnCount; i++) |
| | 0 | 1639 | | { |
| | 0 | 1640 | | T[] column = columns[i].TArray; |
| | 0 | 1641 | | T[] newColumn = new T[column.Length]; |
| | 0 | 1642 | | for (int j = 0; j < sortedRowIDs.Length; j++) |
| | 0 | 1643 | | { |
| | 0 | 1644 | | int rowID = sortedRowIDs[j]; |
| | 0 | 1645 | | int oldRowIndex = RowIDToDenseIndexMap[rowID]; |
| | | 1646 | | |
| | 0 | 1647 | | newColumn[j] = column[oldRowIndex]; |
| | 0 | 1648 | | } |
| | | 1649 | | |
| | 0 | 1650 | | columns[i].TArray = newColumn; |
| | 0 | 1651 | | } |
| | 0 | 1652 | | } |
| | | 1653 | | |
| | | 1654 | | // Internal |
| | | 1655 | | |
| | | 1656 | | internal void AddTypeNameEntryForUnityObjectColumn() |
| | 0 | 1657 | | { |
| | 0 | 1658 | | int nameArrayLength = AllObjectRefTypeNames?.Length ?? 0; |
| | 0 | 1659 | | Array.Resize(ref AllObjectRefTypeNames, nameArrayLength + 1); |
| | 0 | 1660 | | AllObjectRefTypeNames[nameArrayLength] = UnityObjectString; |
| | 0 | 1661 | | } |
| | | 1662 | | |
| | | 1663 | | internal void RemoveTypeNameEntryForUnityObjectColumn(int columnDenseIndex) |
| | 0 | 1664 | | { |
| | 0 | 1665 | | int nameArrayLength = AllObjectRefTypeNames?.Length ?? 0; |
| | 0 | 1666 | | AllObjectRefTypeNames[columnDenseIndex] = AllObjectRefTypeNames[nameArrayLength]; |
| | 0 | 1667 | | Array.Resize(ref AllObjectRefTypeNames, nameArrayLength - 1); |
| | 0 | 1668 | | } |
| | | 1669 | | |
| | | 1670 | | internal void AssertObjectColumnIDValid(int columnID) |
| | 0 | 1671 | | { |
| | 0 | 1672 | | AssertColumnIDValid(columnID); |
| | 0 | 1673 | | if (ColumnIDToDenseIndexMap[columnID].ColumnType != Serializable.SerializableTypes.Object) |
| | 0 | 1674 | | { |
| | 0 | 1675 | | throw new ArgumentException("Column ID must correspond to a UnityEngine.Object column."); |
| | | 1676 | | } |
| | 0 | 1677 | | } |
| | | 1678 | | |
| | | 1679 | | internal int AddColumnInternal<T>(string columnName, ref ArrayHolder<T>[] allColumnsOfType, |
| | | 1680 | | Serializable.SerializableTypes typeIndex, int insertAtColumnID) |
| | 0 | 1681 | | { |
| | 0 | 1682 | | if (insertAtColumnID >= 0) |
| | 0 | 1683 | | { |
| | 0 | 1684 | | AssertColumnIDValid(insertAtColumnID); |
| | 0 | 1685 | | } |
| | | 1686 | | |
| | 0 | 1687 | | int columnCount = allColumnsOfType?.Length ?? 0; |
| | 0 | 1688 | | Array.Resize(ref allColumnsOfType, columnCount + 1); |
| | 0 | 1689 | | allColumnsOfType[columnCount].TArray = new T[RowCount]; |
| | | 1690 | | |
| | 0 | 1691 | | int columnID = ColumnEntriesFreeListHead; |
| | 0 | 1692 | | string[] columnNamesForType = AllColumnNames[(int)typeIndex].TArray; |
| | 0 | 1693 | | int columnNamesCount = columnNamesForType?.Length ?? 0; |
| | 0 | 1694 | | Array.Resize(ref columnNamesForType, columnNamesCount + 1); |
| | 0 | 1695 | | columnNamesForType[columnNamesCount] = columnName == null ? columnID.ToString() : columnName; |
| | 0 | 1696 | | AllColumnNames[(int)typeIndex].TArray = columnNamesForType; |
| | | 1697 | | |
| | | 1698 | | |
| | 0 | 1699 | | int columnIDToDenseIndexMapLength = ColumnIDToDenseIndexMap?.Length ?? 0; |
| | 0 | 1700 | | if (columnID >= columnIDToDenseIndexMapLength) |
| | 0 | 1701 | | { |
| | 0 | 1702 | | int newSize = columnIDToDenseIndexMapLength * 2; |
| | 0 | 1703 | | newSize = newSize == 0 ? 1 : newSize; |
| | 0 | 1704 | | Array.Resize(ref ColumnIDToDenseIndexMap, newSize); |
| | 0 | 1705 | | for (int i = columnIDToDenseIndexMapLength; i < newSize; i++) |
| | 0 | 1706 | | { |
| | 0 | 1707 | | ref ColumnEntry entry = ref ColumnIDToDenseIndexMap[i]; |
| | 0 | 1708 | | entry.ColumnDenseIndex = i + 1; |
| | 0 | 1709 | | entry.ColumnType = Serializable.SerializableTypes.Invalid; |
| | 0 | 1710 | | } |
| | | 1711 | | |
| | 0 | 1712 | | Array.Resize(ref ColumnIDToSortOrderMap, newSize); |
| | 0 | 1713 | | for (int i = columnIDToDenseIndexMapLength; i < newSize; i++) |
| | 0 | 1714 | | { |
| | 0 | 1715 | | ColumnIDToSortOrderMap[i] = -1; |
| | 0 | 1716 | | } |
| | 0 | 1717 | | } |
| | | 1718 | | |
| | 0 | 1719 | | ColumnEntriesFreeListHead = ColumnIDToDenseIndexMap[columnID].ColumnDenseIndex; |
| | | 1720 | | |
| | 0 | 1721 | | ref int[] denseIndexToIDMap = ref ColumnDenseIndexToIDMap[(int)typeIndex].TArray; |
| | 0 | 1722 | | int denseIndexToIDMapLength = denseIndexToIDMap?.Length ?? 0; |
| | 0 | 1723 | | Array.Resize(ref denseIndexToIDMap, denseIndexToIDMapLength + 1); |
| | 0 | 1724 | | denseIndexToIDMap[denseIndexToIDMapLength] = columnID; |
| | | 1725 | | |
| | 0 | 1726 | | ref ColumnEntry newEntry = ref ColumnIDToDenseIndexMap[columnID]; |
| | 0 | 1727 | | newEntry.ColumnDenseIndex = denseIndexToIDMapLength; |
| | 0 | 1728 | | newEntry.ColumnType = typeIndex; |
| | | 1729 | | |
| | 0 | 1730 | | int insertAtSortedIndex = |
| | | 1731 | | insertAtColumnID < 0 ? CombinedColumnCount : ColumnIDToSortOrderMap[insertAtColumnID]; |
| | 0 | 1732 | | Array.Resize(ref SortedOrderToColumnIDMap, CombinedColumnCount + 1); |
| | 0 | 1733 | | for (int i = CombinedColumnCount; i > insertAtSortedIndex; i--) |
| | 0 | 1734 | | { |
| | 0 | 1735 | | int currentColumnID = SortedOrderToColumnIDMap[i - 1]; |
| | 0 | 1736 | | SortedOrderToColumnIDMap[i] = currentColumnID; |
| | 0 | 1737 | | ColumnIDToSortOrderMap[currentColumnID] = i; |
| | 0 | 1738 | | } |
| | | 1739 | | |
| | 0 | 1740 | | if (typeIndex == Serializable.SerializableTypes.Object) |
| | 0 | 1741 | | { |
| | 0 | 1742 | | AddTypeNameEntryForUnityObjectColumn(); |
| | 0 | 1743 | | } |
| | | 1744 | | |
| | 0 | 1745 | | ColumnIDToSortOrderMap[columnID] = insertAtSortedIndex; |
| | 0 | 1746 | | SortedOrderToColumnIDMap[insertAtSortedIndex] = columnID; |
| | | 1747 | | |
| | 0 | 1748 | | ++CombinedColumnCount; |
| | 0 | 1749 | | DataVersion++; |
| | | 1750 | | |
| | 0 | 1751 | | return columnID; |
| | 0 | 1752 | | } |
| | | 1753 | | |
| | | 1754 | | internal void RemoveColumnInternal<T>(ref ArrayHolder<T>[] allColumnsOfType, |
| | | 1755 | | Serializable.SerializableTypes typeIndex, int columnID) |
| | 0 | 1756 | | { |
| | 0 | 1757 | | AssertColumnIDValid(columnID); |
| | 0 | 1758 | | int columnLocation = ColumnIDToDenseIndexMap[columnID].ColumnDenseIndex; |
| | | 1759 | | |
| | 0 | 1760 | | int lastIndex = allColumnsOfType.Length - 1; |
| | 0 | 1761 | | allColumnsOfType[columnLocation] = allColumnsOfType[lastIndex]; |
| | 0 | 1762 | | Array.Resize(ref allColumnsOfType, lastIndex); |
| | | 1763 | | |
| | 0 | 1764 | | ref string[] columnNamesOfType = ref AllColumnNames[(int)typeIndex].TArray; |
| | 0 | 1765 | | columnNamesOfType[columnLocation] = columnNamesOfType[lastIndex]; |
| | 0 | 1766 | | Array.Resize(ref columnNamesOfType, lastIndex); |
| | | 1767 | | |
| | 0 | 1768 | | int columnOrder = ColumnIDToSortOrderMap[columnID]; |
| | | 1769 | | |
| | 0 | 1770 | | ref int[] denseIndicesOfType = ref ColumnDenseIndexToIDMap[(int)typeIndex].TArray; |
| | 0 | 1771 | | int sparseIndexToSwap = denseIndicesOfType[lastIndex]; |
| | | 1772 | | |
| | 0 | 1773 | | ColumnIDToDenseIndexMap[sparseIndexToSwap].ColumnDenseIndex = columnLocation; |
| | 0 | 1774 | | ref ColumnEntry sparseIndexToFree = ref ColumnIDToDenseIndexMap[columnID]; |
| | 0 | 1775 | | sparseIndexToFree.ColumnType = Serializable.SerializableTypes.Invalid; |
| | 0 | 1776 | | sparseIndexToFree.ColumnDenseIndex = ColumnEntriesFreeListHead; |
| | | 1777 | | |
| | 0 | 1778 | | ColumnEntriesFreeListHead = columnID; |
| | | 1779 | | |
| | 0 | 1780 | | denseIndicesOfType[columnLocation] = sparseIndexToSwap; |
| | 0 | 1781 | | Array.Resize(ref denseIndicesOfType, lastIndex); |
| | | 1782 | | |
| | 0 | 1783 | | if (typeIndex == Serializable.SerializableTypes.Object) |
| | 0 | 1784 | | { |
| | 0 | 1785 | | RemoveTypeNameEntryForUnityObjectColumn(columnLocation); |
| | 0 | 1786 | | } |
| | | 1787 | | |
| | 0 | 1788 | | for (int i = columnOrder + 1; i < CombinedColumnCount; i++) |
| | 0 | 1789 | | { |
| | 0 | 1790 | | int currentColumnID = SortedOrderToColumnIDMap[i]; |
| | 0 | 1791 | | SortedOrderToColumnIDMap[i - 1] = currentColumnID; |
| | 0 | 1792 | | ColumnIDToSortOrderMap[currentColumnID] = i - 1; |
| | 0 | 1793 | | } |
| | | 1794 | | |
| | 0 | 1795 | | ColumnIDToSortOrderMap[columnID] = -1; |
| | | 1796 | | |
| | 0 | 1797 | | Array.Resize(ref SortedOrderToColumnIDMap, CombinedColumnCount - 1); |
| | | 1798 | | |
| | 0 | 1799 | | --CombinedColumnCount; |
| | 0 | 1800 | | DataVersion++; |
| | 0 | 1801 | | } |
| | | 1802 | | |
| | | 1803 | | internal void InsertRowsOfTypeInternal<T>(ref ArrayHolder<T>[] allColumnsOfType, int insertAt, |
| | | 1804 | | int numberOfNewRows) |
| | 0 | 1805 | | { |
| | 0 | 1806 | | int columnCount = allColumnsOfType?.Length ?? 0; |
| | 0 | 1807 | | for (int i = 0; i < columnCount; i++) |
| | 0 | 1808 | | { |
| | 0 | 1809 | | ref T[] rows = ref allColumnsOfType[i].TArray; |
| | 0 | 1810 | | int newRowCount = RowCount + numberOfNewRows; |
| | 0 | 1811 | | Array.Resize(ref rows, newRowCount); |
| | 0 | 1812 | | for (int j = newRowCount - 1; j > insertAt + numberOfNewRows - 1; j--) |
| | 0 | 1813 | | { |
| | 0 | 1814 | | rows[j] = rows[j - numberOfNewRows]; |
| | 0 | 1815 | | } |
| | | 1816 | | |
| | 0 | 1817 | | for (int j = 0; j < numberOfNewRows; j++) |
| | 0 | 1818 | | { |
| | 0 | 1819 | | rows[insertAt + j] = default; |
| | 0 | 1820 | | } |
| | 0 | 1821 | | } |
| | 0 | 1822 | | } |
| | | 1823 | | |
| | | 1824 | | internal void DeleteRowsOfTypeInternal<T>(ref ArrayHolder<T>[] allColumnsOfType, int removeAt, |
| | | 1825 | | int numberOfRowsToDelete) |
| | 0 | 1826 | | { |
| | 0 | 1827 | | int columnCount = allColumnsOfType?.Length ?? 0; |
| | | 1828 | | |
| | 0 | 1829 | | for (int i = 0; i < columnCount; i++) |
| | 0 | 1830 | | { |
| | 0 | 1831 | | ref T[] rows = ref allColumnsOfType[i].TArray; |
| | 0 | 1832 | | int newRowCount = RowCount - numberOfRowsToDelete; |
| | | 1833 | | |
| | 0 | 1834 | | for (int j = removeAt + numberOfRowsToDelete; j < RowCount; j++) |
| | 0 | 1835 | | { |
| | 0 | 1836 | | rows[j - numberOfRowsToDelete] = rows[j]; |
| | 0 | 1837 | | } |
| | | 1838 | | |
| | 0 | 1839 | | Array.Resize(ref rows, newRowCount); |
| | 0 | 1840 | | } |
| | 0 | 1841 | | } |
| | | 1842 | | |
| | | 1843 | | internal ref T GetCellRef<T>(int rowID, int columnID, ref ArrayHolder<T>[] allColumnsOfType) |
| | 0 | 1844 | | { |
| | 0 | 1845 | | AssertColumnIDValid(columnID); |
| | 0 | 1846 | | AssertRowIDValid(rowID); |
| | 0 | 1847 | | int column = ColumnIDToDenseIndexMap[columnID].ColumnDenseIndex; |
| | 0 | 1848 | | int row = RowIDToDenseIndexMap[rowID]; |
| | 0 | 1849 | | return ref allColumnsOfType[column][row]; |
| | 0 | 1850 | | } |
| | | 1851 | | |
| | | 1852 | | internal T GetCell<T>(int rowID, int columnID, ref ArrayHolder<T>[] allColumnsOfType) |
| | 0 | 1853 | | { |
| | 0 | 1854 | | AssertColumnIDValid(columnID); |
| | 0 | 1855 | | AssertRowIDValid(rowID); |
| | 0 | 1856 | | int column = ColumnIDToDenseIndexMap[columnID].ColumnDenseIndex; |
| | 0 | 1857 | | int row = RowIDToDenseIndexMap[rowID]; |
| | 0 | 1858 | | return allColumnsOfType[column][row]; |
| | 0 | 1859 | | } |
| | | 1860 | | |
| | | 1861 | | internal ulong SetCell<T>(int rowID, int columnID, ref ArrayHolder<T>[] allColumnsOfType, T value) |
| | 0 | 1862 | | { |
| | 0 | 1863 | | AssertColumnIDValid(columnID); |
| | 0 | 1864 | | AssertRowIDValid(rowID); |
| | 0 | 1865 | | int column = ColumnIDToDenseIndexMap[columnID].ColumnDenseIndex; |
| | 0 | 1866 | | int row = RowIDToDenseIndexMap[rowID]; |
| | 0 | 1867 | | allColumnsOfType[column][row] = value; |
| | 0 | 1868 | | DataVersion++; |
| | 0 | 1869 | | return DataVersion; |
| | 0 | 1870 | | } |
| | | 1871 | | |
| | | 1872 | | internal T[] GetColumn<T>(int columnID, ref ArrayHolder<T>[] allColumnsOfType) |
| | 0 | 1873 | | { |
| | 0 | 1874 | | AssertColumnIDValid(columnID); |
| | 0 | 1875 | | int column = ColumnIDToDenseIndexMap[columnID].ColumnDenseIndex; |
| | 0 | 1876 | | return allColumnsOfType[column].TArray; |
| | 0 | 1877 | | } |
| | | 1878 | | |
| | | 1879 | | internal void SetRowOrderForColumns<T>(ArrayHolder<T>[] columns, int oldSortOrder, int newSortOrder) |
| | 0 | 1880 | | { |
| | 0 | 1881 | | int columnCount = columns?.Length ?? 0; |
| | 0 | 1882 | | int iterDirection = newSortOrder > oldSortOrder ? 1 : -1; |
| | 0 | 1883 | | for (int i = 0; i < columnCount; i++) |
| | 0 | 1884 | | { |
| | 0 | 1885 | | T[] column = columns[i].TArray; |
| | | 1886 | | |
| | 0 | 1887 | | for (int j = oldSortOrder; j != newSortOrder; j += iterDirection) |
| | 0 | 1888 | | { |
| | 0 | 1889 | | column[j] = column[j + iterDirection]; |
| | 0 | 1890 | | } |
| | 0 | 1891 | | } |
| | 0 | 1892 | | } |
| | | 1893 | | |
| | | 1894 | | internal void AssertSortedColumnsArgValid(int[] sortedColumnIDs) |
| | 0 | 1895 | | { |
| | 0 | 1896 | | if (sortedColumnIDs == null) |
| | 0 | 1897 | | { |
| | 0 | 1898 | | throw new ArgumentException("sortedColumnIDs array cannot be null."); |
| | | 1899 | | } |
| | | 1900 | | |
| | 0 | 1901 | | if (sortedColumnIDs.Length != SortedOrderToColumnIDMap.Length) |
| | 0 | 1902 | | { |
| | 0 | 1903 | | throw new ArgumentException("sortedColumnIDs array must be the same length as GetColumnCount."); |
| | | 1904 | | } |
| | | 1905 | | |
| | 0 | 1906 | | for (int i = 0; i < sortedColumnIDs.Length; i++) |
| | 0 | 1907 | | { |
| | 0 | 1908 | | AssertColumnIDValid(sortedColumnIDs[i]); |
| | 0 | 1909 | | } |
| | 0 | 1910 | | } |
| | | 1911 | | |
| | | 1912 | | internal void AssertColumnSortOrderValid(int sortedOrder) |
| | 0 | 1913 | | { |
| | 0 | 1914 | | if (sortedOrder >= CombinedColumnCount || sortedOrder < 0) |
| | 0 | 1915 | | { |
| | 0 | 1916 | | throw new ArgumentException("Invalid column sort order argument: " + sortedOrder); |
| | | 1917 | | } |
| | 0 | 1918 | | } |
| | | 1919 | | |
| | | 1920 | | internal void AssertRowSortOrderValid(int sortedOrder) |
| | 0 | 1921 | | { |
| | 0 | 1922 | | if (sortedOrder >= RowCount || sortedOrder < 0) |
| | 0 | 1923 | | { |
| | 0 | 1924 | | throw new ArgumentException("Invalid row sort order argument: " + sortedOrder); |
| | | 1925 | | } |
| | 0 | 1926 | | } |
| | | 1927 | | |
| | | 1928 | | internal void AssertSortRowsArgValid(int[] sortedRowIDs) |
| | 0 | 1929 | | { |
| | 0 | 1930 | | if (sortedRowIDs == null) |
| | 0 | 1931 | | { |
| | 0 | 1932 | | throw new ArgumentException("sortedRowIDs array cannot be null."); |
| | | 1933 | | } |
| | | 1934 | | |
| | 0 | 1935 | | if (sortedRowIDs.Length != RowDenseIndexToIDMap.Length) |
| | 0 | 1936 | | { |
| | 0 | 1937 | | throw new ArgumentException("sortedRowIDs array must be the same length as GetRowCount."); |
| | | 1938 | | } |
| | | 1939 | | |
| | 0 | 1940 | | for (int i = 0; i < sortedRowIDs.Length; i++) |
| | 0 | 1941 | | { |
| | 0 | 1942 | | AssertRowIDValid(sortedRowIDs[i]); |
| | 0 | 1943 | | } |
| | 0 | 1944 | | } |
| | | 1945 | | |
| | | 1946 | | [Serializable] |
| | | 1947 | | internal struct ColumnEntry |
| | | 1948 | | { |
| | | 1949 | | public Serializable.SerializableTypes ColumnType; |
| | | 1950 | | public int ColumnDenseIndex; |
| | | 1951 | | } |
| | | 1952 | | } |
| | | 1953 | | } |